org.xwiki.velocity.introspection
Class MethodArgumentsUberspector

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

public class MethodArgumentsUberspector
extends 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)
 

Since:
4.1M2
Version:
$Id: b5069ae9d5f8de1601c5cef3a610e693f1256fb5 $
See Also:
ChainableUberspector

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 inherited from class org.xwiki.velocity.introspection.AbstractChainableUberspector
inner
 
Fields inherited from class org.apache.velocity.util.introspection.UberspectImpl
introspector, log
 
Constructor Summary
MethodArgumentsUberspector()
           
 
Method Summary
 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.xwiki.velocity.introspection.AbstractChainableUberspector
getIterator, getPropertyGet, getPropertySet, init, 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

MethodArgumentsUberspector

public MethodArgumentsUberspector()
Method Detail

setRuntimeServices

public void setRuntimeServices(org.apache.velocity.runtime.RuntimeServices runtimeServices)
Specified by:
setRuntimeServices in interface org.apache.velocity.util.RuntimeServicesAware

getMethod

public org.apache.velocity.util.introspection.VelMethod getMethod(Object obj,
                                                                  String methodName,
                                                                  Object[] args,
                                                                  org.apache.velocity.util.introspection.Info i)
                                                           throws Exception
Specified by:
getMethod in interface org.apache.velocity.util.introspection.Uberspect
Overrides:
getMethod in class AbstractChainableUberspector
Throws:
Exception


Copyright © 2004-2013 XWiki. All Rights Reserved.