public class AnnotationBoxingUberspect
extends org.apache.velocity.util.introspection.UberspectImpl
More specifically this uberspect will inspect any target method call or property for annotations that are marked as
ReturnValueAnnotation
s and box the result of calling or accessing the target with these annotations.
org.apache.velocity.util.introspection.UberspectImpl.VelGetterImpl, org.apache.velocity.util.introspection.UberspectImpl.VelMethodImpl, org.apache.velocity.util.introspection.UberspectImpl.VelSetterImpl
Constructor and Description |
---|
AnnotationBoxingUberspect() |
Modifier and Type | Method and Description |
---|---|
protected Class |
getClassForTargetObject(Object targetObject)
Template method for returning the actual concrete class of a the provided object.
|
Iterator |
getIterator(Object obj,
org.apache.velocity.util.introspection.Info info)
Get an iterator responsible for preserving annotations while iterating over a collection that has collection
inheritable return value annotations.'
|
org.apache.velocity.util.introspection.VelMethod |
getMethod(Object obj,
String methodName,
Object[] args,
org.apache.velocity.util.introspection.Info info)
Return a method that knows how to unbox method call targets and parameters and to box return values
according to the return value boxing policy.
|
protected Collection<Annotation> |
getMethodAnnotations(Method method)
Retrieve any annotations on the supplied method that are meta-annotated as a
ReturnValueAnnotation |
org.apache.velocity.util.introspection.VelPropertyGet |
getPropertyGet(Object obj,
String identifier,
org.apache.velocity.util.introspection.Info info)
Get a property getting strategy that will box the end result with any return value annotations on the property getter
|
void |
init() |
public void init() throws Exception
init
in interface org.apache.velocity.util.introspection.Uberspect
init
in class org.apache.velocity.util.introspection.UberspectImpl
Exception
public final org.apache.velocity.util.introspection.VelMethod getMethod(Object obj, String methodName, Object[] args, org.apache.velocity.util.introspection.Info info) throws Exception
getMethod
in interface org.apache.velocity.util.introspection.Uberspect
getMethod
in class org.apache.velocity.util.introspection.UberspectImpl
obj
- Object to locate the method onmethodName
- Name of the method to locateargs
- Method call argumentsinfo
- Current template infoException
public final Iterator getIterator(Object obj, org.apache.velocity.util.introspection.Info info) throws Exception
getIterator
in interface org.apache.velocity.util.introspection.Uberspect
getIterator
in class org.apache.velocity.util.introspection.UberspectImpl
obj
- object to get an iterator forinfo
- current template infoException
public final org.apache.velocity.util.introspection.VelPropertyGet getPropertyGet(Object obj, String identifier, org.apache.velocity.util.introspection.Info info) throws Exception
getPropertyGet
in interface org.apache.velocity.util.introspection.Uberspect
getPropertyGet
in class org.apache.velocity.util.introspection.UberspectImpl
obj
- Object on which a property is being retrievedidentifier
- Property identifierinfo
- Current template infoException
protected Collection<Annotation> getMethodAnnotations(Method method)
ReturnValueAnnotation
method
- Method to searchReturnValueAnnotation
on the provided method.protected Class getClassForTargetObject(Object targetObject)
This method should be overridden in environments where objects may be proxied in such a way that method annotations are not reflected by the proxying object class.
This implementation simply returns targetObject.getClass()
targetObject
- The object for which the class is being queriedCopyright © 2003–2016 Atlassian. All rights reserved.