|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.velocity.util.introspection.UberspectImpl
org.xwiki.velocity.introspection.LinkingUberspector
public class LinkingUberspector
Since 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 than null. 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 a SecureUberspector is used
as the only entry in the array.
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 | |
|---|---|
static java.lang.String |
UBERSPECT_ARRAY_CLASSNAMES
The key of the parameter that allows defining the array of uberspectors. |
| Fields inherited from class org.apache.velocity.util.introspection.UberspectImpl |
|---|
introspector, log |
| Constructor Summary | |
|---|---|
LinkingUberspector()
|
|
| Method Summary | |
|---|---|
java.util.Iterator |
getIterator(java.lang.Object obj,
org.apache.velocity.util.introspection.Info i)
|
org.apache.velocity.util.introspection.VelMethod |
getMethod(java.lang.Object obj,
java.lang.String methodName,
java.lang.Object[] args,
org.apache.velocity.util.introspection.Info i)
|
org.apache.velocity.util.introspection.VelPropertyGet |
getPropertyGet(java.lang.Object obj,
java.lang.String identifier,
org.apache.velocity.util.introspection.Info i)
|
org.apache.velocity.util.introspection.VelPropertySet |
getPropertySet(java.lang.Object obj,
java.lang.String identifier,
java.lang.Object arg,
org.apache.velocity.util.introspection.Info i)
|
void |
init()
|
protected void |
initializeUberspector(java.lang.String classname)
Instantiates and initializes an uberspector class and adds it to the array. |
protected org.apache.velocity.util.introspection.Uberspect |
instantiateUberspector(java.lang.String classname)
Tries to create an uberspector instance using reflection. |
void |
setRuntimeServices(org.apache.velocity.runtime.RuntimeServices rs)
|
| 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 |
| Methods inherited from interface org.apache.velocity.util.introspection.UberspectLoggable |
|---|
setLog, setRuntimeLogger |
| Field Detail |
|---|
public static final java.lang.String UBERSPECT_ARRAY_CLASSNAMES
| Constructor Detail |
|---|
public LinkingUberspector()
| Method Detail |
|---|
public void setRuntimeServices(org.apache.velocity.runtime.RuntimeServices rs)
setRuntimeServices in interface org.apache.velocity.util.RuntimeServicesAwareRuntimeServicesAware.setRuntimeServices(org.apache.velocity.runtime.RuntimeServices)public void init()
This implementation initializes the array of uberspectors.
init in interface org.apache.velocity.util.introspection.Uberspectinit in class org.apache.velocity.util.introspection.UberspectImplUberspect.init()protected void initializeUberspector(java.lang.String classname)
classname - The name of the uberspector class to add to the chain.protected org.apache.velocity.util.introspection.Uberspect instantiateUberspector(java.lang.String classname)
classname - The name of the uberspector class to instantiate.
Uberspect, null is returned.
public java.util.Iterator getIterator(java.lang.Object obj,
org.apache.velocity.util.introspection.Info i)
throws java.lang.Exception
getIterator in interface org.apache.velocity.util.introspection.UberspectgetIterator in class org.apache.velocity.util.introspection.UberspectImpljava.lang.ExceptionUberspect.getIterator(java.lang.Object,
org.apache.velocity.util.introspection.Info)
public org.apache.velocity.util.introspection.VelMethod getMethod(java.lang.Object obj,
java.lang.String methodName,
java.lang.Object[] args,
org.apache.velocity.util.introspection.Info i)
throws java.lang.Exception
getMethod in interface org.apache.velocity.util.introspection.UberspectgetMethod in class org.apache.velocity.util.introspection.UberspectImpljava.lang.ExceptionUberspect.getMethod(java.lang.Object, java.lang.String,
java.lang.Object[], org.apache.velocity.util.introspection.Info)
public org.apache.velocity.util.introspection.VelPropertyGet getPropertyGet(java.lang.Object obj,
java.lang.String identifier,
org.apache.velocity.util.introspection.Info i)
throws java.lang.Exception
getPropertyGet in interface org.apache.velocity.util.introspection.UberspectgetPropertyGet in class org.apache.velocity.util.introspection.UberspectImpljava.lang.ExceptionUberspect.getPropertyGet(java.lang.Object, java.lang.String,
org.apache.velocity.util.introspection.Info)
public org.apache.velocity.util.introspection.VelPropertySet getPropertySet(java.lang.Object obj,
java.lang.String identifier,
java.lang.Object arg,
org.apache.velocity.util.introspection.Info i)
throws java.lang.Exception
getPropertySet in interface org.apache.velocity.util.introspection.UberspectgetPropertySet in class org.apache.velocity.util.introspection.UberspectImpljava.lang.ExceptionUberspect.getPropertySet(java.lang.Object, java.lang.String,
java.lang.Object, org.apache.velocity.util.introspection.Info)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||