Package org.xwiki.velocity.introspection
Class MethodArgumentsUberspector
- java.lang.Object
-
- org.apache.velocity.util.introspection.UberspectImpl
-
- org.apache.velocity.util.introspection.AbstractChainableUberspector
-
- org.xwiki.velocity.introspection.MethodArgumentsUberspector
-
- All Implemented Interfaces:
org.apache.velocity.util.introspection.ChainableUberspector
,org.apache.velocity.util.introspection.Uberspect
,org.apache.velocity.util.RuntimeServicesAware
public class MethodArgumentsUberspector extends org.apache.velocity.util.introspection.AbstractChainableUberspector implements org.apache.velocity.util.RuntimeServicesAware
Chainable Velocity Uberspector that tries to convert method arguments to formal parameter types when the passed arguments don't match the method signature. In other words, it looks for a method matching the passed arguments and if none is found then it tries the convert the arguments to match the available method signatures (the available methods with the same name and the same number of parameters but with different parameter types). E.g.:$obj.someMethod('VALUE') // will forward to obj.someMethod(SomeEnum.VALUE) // if obj has someMethod(SomeEnum) and not someMethod(String)
Also handle Optional return values and unwraps them.
- Since:
- 4.1M2
- Version:
- $Id: 5225e2b9ed46dfe0fcad7eac955bf849ddbae084 $
-
-
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
-
-
Constructor Summary
Constructors Constructor Description MethodArgumentsUberspector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.velocity.util.introspection.VelMethod
getMethod(Object obj, String methodName, Object[] args, org.apache.velocity.util.introspection.Info i)
void
setRuntimeServices(org.apache.velocity.runtime.RuntimeServices runtimeServices)
-
Methods inherited from class org.apache.velocity.util.introspection.AbstractChainableUberspector
getIterator, getPropertyGet, getPropertySet, init, wrap
-
-
-
-
Method Detail
-
setRuntimeServices
public void setRuntimeServices(org.apache.velocity.runtime.RuntimeServices runtimeServices)
- Specified by:
setRuntimeServices
in interfaceorg.apache.velocity.util.RuntimeServicesAware
- Overrides:
setRuntimeServices
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)
- Specified by:
getMethod
in interfaceorg.apache.velocity.util.introspection.Uberspect
- Overrides:
getMethod
in classorg.apache.velocity.util.introspection.AbstractChainableUberspector
-
-