Class LinkingUberspector
- java.lang.Object
-
- org.apache.velocity.util.introspection.UberspectImpl
-
- org.xwiki.velocity.introspection.LinkingUberspector
-
- All Implemented Interfaces:
org.apache.velocity.util.introspection.Uberspect
,org.apache.velocity.util.RuntimeServicesAware
@Deprecated public class LinkingUberspector extends org.apache.velocity.util.introspection.UberspectImpl implements org.apache.velocity.util.introspection.Uberspect, org.apache.velocity.util.RuntimeServicesAware
Deprecated.since 8.0M1; chaining uberspectors is much more powerful, this class was never more than a proof of conceptSince the current version of the Velocity engine (1.5) does not allow more than one uberspector, this class is a workaround. It manually constructs an array of uberspectors, loading the classes in the order defined in the
"runtime.introspector.uberspect.arrayClasses"
property, and after that forwards calls to each of the uberspectors, in order, until one of them returns something different thannull
. Note that the calls will be made from the leftmost class to the rightmost one. This allows building and combining different small uberspectors that perform a specialised search for methods, instead of bloating a single class with different introspection tricks.This is not actually part of the array, but is more of a handle that allows the calls intended for only one uberspector to reach the array. It duplicates some of the code from the velocity runtime initialization code, hoping that a future version of the engine will support this natively.
The array is defined using the configuration parameter
runtime.introspector.uberspect.arrayClasses
. This property should contain a list of canonical class names. Any wrong entry in the list will be ignored. If this property is not defined or contains only wrong classnames, then by default aSecureUberspector
is used as the only entry in the array.- Since:
- 1.5RC1
- Version:
- $Id: 69d0ce09c2e8218cdfc69771779abaf3325edbce $
- See Also:
ChainingUberspector
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.velocity.util.introspection.UberspectImpl
org.apache.velocity.util.introspection.UberspectImpl.VelGetterImpl, org.apache.velocity.util.introspection.UberspectImpl.VelMethodImpl, org.apache.velocity.util.introspection.UberspectImpl.VelSetterImpl
-
-
Field Summary
Fields Modifier and Type Field Description static String
UBERSPECT_ARRAY_CLASSNAMES
Deprecated.The key of the parameter that allows defining the array of uberspectors.
-
Constructor Summary
Constructors Constructor Description LinkingUberspector()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Iterator
getIterator(Object obj, org.apache.velocity.util.introspection.Info i)
Deprecated.org.apache.velocity.util.introspection.VelMethod
getMethod(Object obj, String methodName, Object[] args, org.apache.velocity.util.introspection.Info i)
Deprecated.org.apache.velocity.util.introspection.VelPropertyGet
getPropertyGet(Object obj, String identifier, org.apache.velocity.util.introspection.Info i)
Deprecated.org.apache.velocity.util.introspection.VelPropertySet
getPropertySet(Object obj, String identifier, Object arg, org.apache.velocity.util.introspection.Info i)
Deprecated.void
init()
Deprecated.protected void
initializeUberspector(String classname)
Deprecated.Instantiates and initializes an uberspector class and adds it to the array.protected org.apache.velocity.util.introspection.Uberspect
instantiateUberspector(String classname)
Deprecated.Tries to create an uberspector instance using reflection.-
Methods inherited from class org.apache.velocity.util.introspection.UberspectImpl
getConversionHandler, setLog, setRuntimeServices
-
-
-
-
Field Detail
-
UBERSPECT_ARRAY_CLASSNAMES
public static final String UBERSPECT_ARRAY_CLASSNAMES
Deprecated.The key of the parameter that allows defining the array of uberspectors.- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init()
Deprecated.This implementation initializes the array of uberspectors.
- Specified by:
init
in interfaceorg.apache.velocity.util.introspection.Uberspect
- Overrides:
init
in classorg.apache.velocity.util.introspection.UberspectImpl
- See Also:
Uberspect.init()
-
initializeUberspector
protected void initializeUberspector(String classname)
Deprecated.Instantiates and initializes an uberspector class and adds it to the array. Also set the log and runtime services, if the class implements the proper interfaces.- Parameters:
classname
- The name of the uberspector class to add to the chain.
-
instantiateUberspector
protected org.apache.velocity.util.introspection.Uberspect instantiateUberspector(String classname)
Deprecated.Tries to create an uberspector instance using reflection.- Parameters:
classname
- The name of the uberspector class to instantiate.- Returns:
- An instance of the specified Uberspector. If the class cannot be instantiated using the default
constructor, or does not implement
Uberspect
,null
is returned.
-
getIterator
public Iterator getIterator(Object obj, org.apache.velocity.util.introspection.Info i)
Deprecated.- Specified by:
getIterator
in interfaceorg.apache.velocity.util.introspection.Uberspect
- Overrides:
getIterator
in classorg.apache.velocity.util.introspection.UberspectImpl
-
getMethod
public org.apache.velocity.util.introspection.VelMethod getMethod(Object obj, String methodName, Object[] args, org.apache.velocity.util.introspection.Info i)
Deprecated.- Specified by:
getMethod
in interfaceorg.apache.velocity.util.introspection.Uberspect
- Overrides:
getMethod
in classorg.apache.velocity.util.introspection.UberspectImpl
-
getPropertyGet
public org.apache.velocity.util.introspection.VelPropertyGet getPropertyGet(Object obj, String identifier, org.apache.velocity.util.introspection.Info i)
Deprecated.- Specified by:
getPropertyGet
in interfaceorg.apache.velocity.util.introspection.Uberspect
- Overrides:
getPropertyGet
in classorg.apache.velocity.util.introspection.UberspectImpl
-
getPropertySet
public org.apache.velocity.util.introspection.VelPropertySet getPropertySet(Object obj, String identifier, Object arg, org.apache.velocity.util.introspection.Info i)
Deprecated.- Specified by:
getPropertySet
in interfaceorg.apache.velocity.util.introspection.Uberspect
- Overrides:
getPropertySet
in classorg.apache.velocity.util.introspection.UberspectImpl
-
-