public class

AnnotationBoxingUberspect

extends UberspectImpl
implements RuntimeServicesAware
java.lang.Object
   ↳ org.apache.velocity.util.introspection.UberspectImpl
     ↳ com.atlassian.confluence.velocity.introspection.AnnotationBoxingUberspect
Known Direct Subclasses

Class Overview

A Velocity uberspect that boxes return values in an annotated form and unboxes them again when used as arguments to or targets of method calls More specifically this uberspect will inspect any target method call or property for annotations that are marked as ReturnValueAnnotations and box the result of calling or accessing the target with these annotations.

Summary

[Expand]
Inherited Fields
From class org.apache.velocity.util.introspection.UberspectImpl
Public Constructors
AnnotationBoxingUberspect()
Public Methods
final Iterator getIterator(Object obj, Info info)
Get an iterator responsible for preserving annotations while iterating over a collection that has collection inheritable return value annotations.'
final VelMethod getMethod(Object obj, String methodName, Object[] args, 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.
final VelPropertyGet getPropertyGet(Object obj, String identifier, Info info)
Get a property getting strategy that will box the end result with any return value annotations on the property getter
void init()
void setRuntimeServices(RuntimeServices runtimeServices)
Protected Methods
Class getClassForTargetObject(Object targetObject)
Template method for returning the actual concrete class of a the provided object.
Collection<Annotation> getMethodAnnotations(Method method)
Retrieve any annotations on the supplied method that are meta-annotated as a ReturnValueAnnotation
[Expand]
Inherited Methods
From class org.apache.velocity.util.introspection.UberspectImpl
From class java.lang.Object
From interface org.apache.velocity.util.RuntimeServicesAware
From interface org.apache.velocity.util.introspection.Uberspect
From interface org.apache.velocity.util.introspection.UberspectLoggable

Public Constructors

public AnnotationBoxingUberspect ()

Public Methods

public final Iterator getIterator (Object obj, Info info)

Get an iterator responsible for preserving annotations while iterating over a collection that has collection inheritable return value annotations.'

Parameters
obj object to get an iterator for
info current template info
Returns
  • Inheritable annotation preserving iterator
Throws
Exception

public final VelMethod getMethod (Object obj, String methodName, Object[] args, 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.

Parameters
obj Object to locate the method on
methodName Name of the method to locate
args Method call arguments
info Current template info
Returns
  • Method calling strategy that will transparently handle boxed arguments and targets while automatically boxing method return values with return value annotations.
Throws
Exception

public final VelPropertyGet getPropertyGet (Object obj, String identifier, Info info)

Get a property getting strategy that will box the end result with any return value annotations on the property getter

Parameters
obj Object on which a property is being retrieved
identifier Property identifier
info Current template info
Returns
  • A return value boxing property getter
Throws
Exception

public void init ()

Throws
Exception

public void setRuntimeServices (RuntimeServices runtimeServices)

Protected Methods

protected Class getClassForTargetObject (Object targetObject)

Template method for returning the actual concrete class of a the provided object. 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()

Parameters
targetObject The object for which the class is being queried
Returns
  • The actual class that should be queried for return value annotations

protected Collection<Annotation> getMethodAnnotations (Method method)

Retrieve any annotations on the supplied method that are meta-annotated as a ReturnValueAnnotation

Parameters
method Method to search
Returns