org.apache.velocity.util.introspection
Class LinkingUberspector

java.lang.Object
  extended by org.apache.velocity.util.introspection.UberspectImpl
      extended by org.apache.velocity.util.introspection.AbstractChainableUberspector
          extended by org.apache.velocity.util.introspection.LinkingUberspector
All Implemented Interfaces:
ChainableUberspector, Uberspect, UberspectLoggable

public class LinkingUberspector
extends AbstractChainableUberspector

When the runtime.introspection.uberspect configuration property contains several uberspector class names, it means those uberspectors will be chained. When an uberspector in the list other than the leftmost does not implement ChainableUberspector, then this utility class is used to provide a basic default chaining where the first non-null result is kept for each introspection call.

Since:
1.6
Version:
$Id: LinkingUberspector.java 10959 2008-07-01 00:12:29Z sdumitriu $
See Also:
ChainableUberspector

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.velocity.util.introspection.UberspectImpl
UberspectImpl.VelGetterImpl, UberspectImpl.VelMethodImpl, UberspectImpl.VelSetterImpl
 
Field Summary
 
Fields inherited from class org.apache.velocity.util.introspection.AbstractChainableUberspector
inner
 
Fields inherited from class org.apache.velocity.util.introspection.UberspectImpl
introspector, log
 
Constructor Summary
LinkingUberspector(Uberspect left, Uberspect right)
          Constructor that takes the two uberspectors to link
 
Method Summary
 Iterator getIterator(Object obj, Info i)
          To support iterative objects used in a #foreach() loop.
 VelMethod getMethod(Object obj, String methodName, Object[] args, Info i)
          Method
 VelPropertyGet getPropertyGet(Object obj, String identifier, Info i)
          Property getter
 VelPropertySet getPropertySet(Object obj, String identifier, Object arg, Info i)
          Property setter
 void init()
          init - the chainable uberspector is responsible for the initialization of the wrapped uberspector
 
Methods inherited from class org.apache.velocity.util.introspection.AbstractChainableUberspector
wrap
 
Methods inherited from class org.apache.velocity.util.introspection.UberspectImpl
setLog, setRuntimeLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkingUberspector

public LinkingUberspector(Uberspect left,
                          Uberspect right)
Constructor that takes the two uberspectors to link

Method Detail

init

public void init()
init - the chainable uberspector is responsible for the initialization of the wrapped uberspector

Init both wrapped uberspectors

Specified by:
init in interface Uberspect
Overrides:
init in class AbstractChainableUberspector
See Also:
Uberspect.init()

getIterator

public Iterator getIterator(Object obj,
                            Info i)
                     throws Exception
To support iterative objects used in a #foreach() loop.

Specified by:
getIterator in interface Uberspect
Overrides:
getIterator in class AbstractChainableUberspector
Parameters:
obj - The iterative object.
i - Info about the object's location.
Returns:
An Iterator object.
Throws:
Exception
See Also:
Uberspect.getIterator(java.lang.Object, org.apache.velocity.util.introspection.Info)

getMethod

public VelMethod getMethod(Object obj,
                           String methodName,
                           Object[] args,
                           Info i)
                    throws Exception
Method

Specified by:
getMethod in interface Uberspect
Overrides:
getMethod in class AbstractChainableUberspector
Returns:
A Velocity Method.
Throws:
Exception
See Also:
Uberspect.getMethod(java.lang.Object, java.lang.String, java.lang.Object[], org.apache.velocity.util.introspection.Info)

getPropertyGet

public VelPropertyGet getPropertyGet(Object obj,
                                     String identifier,
                                     Info i)
                              throws Exception
Property getter

Specified by:
getPropertyGet in interface Uberspect
Overrides:
getPropertyGet in class AbstractChainableUberspector
Returns:
A Velocity Getter Method.
Throws:
Exception
See Also:
Uberspect.getPropertyGet(java.lang.Object, java.lang.String, org.apache.velocity.util.introspection.Info)

getPropertySet

public VelPropertySet getPropertySet(Object obj,
                                     String identifier,
                                     Object arg,
                                     Info i)
                              throws Exception
Property setter

Specified by:
getPropertySet in interface Uberspect
Overrides:
getPropertySet in class AbstractChainableUberspector
Returns:
A Velocity Setter method.
Throws:
Exception
See Also:
Uberspect.getPropertySet(java.lang.Object, java.lang.String, java.lang.Object, org.apache.velocity.util.introspection.Info)


Copyright © 2000-2010 The Apache Software Foundation. All Rights Reserved.