com.atlassian.confluence.velocity.introspection
Class AnnotatedValue

java.lang.Object
  extended by com.atlassian.confluence.velocity.introspection.AnnotatedValue
All Implemented Interfaces:
AnnotationBoxedElement, BoxedValue, BoxingStrategy, AnnotatedElement

public final class AnnotatedValue
extends Object
implements AnnotationBoxedElement

An annotated value associates a collection of annotations with a value.


Constructor Summary
AnnotatedValue(Object value, Collection<Annotation> annotations)
          Construct a new annotated value.
 
Method Summary
 Object box(Object value)
          This will box another object with the same annotations as this value.
 boolean equals(Object o)
           
<T extends Annotation>
T
getAnnotation(Class<T> tClass)
           
 Annotation[] getAnnotations()
           
 Collection<Annotation> getCollectionInheritableAnnotations()
           
 Annotation[] getDeclaredAnnotations()
           
 String getDescription()
           
 int hashCode()
           
 boolean isAnnotationPresent(Class<? extends Annotation> aClass)
           
 String toString()
          Delegates and returns the result of calling toString on the boxed value.
 Object unbox()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnnotatedValue

public AnnotatedValue(Object value,
                      Collection<Annotation> annotations)
Construct a new annotated value. THe iteration order of annotations may not be preserved.

Parameters:
value - The value to annotate
annotations - This values annotations.
Method Detail

isAnnotationPresent

public boolean isAnnotationPresent(Class<? extends Annotation> aClass)
Specified by:
isAnnotationPresent in interface AnnotatedElement

getAnnotation

public <T extends Annotation> T getAnnotation(Class<T> tClass)
Specified by:
getAnnotation in interface AnnotatedElement

getAnnotations

public Annotation[] getAnnotations()
Specified by:
getAnnotations in interface AnnotatedElement

getDeclaredAnnotations

public Annotation[] getDeclaredAnnotations()
Specified by:
getDeclaredAnnotations in interface AnnotatedElement

unbox

public Object unbox()
Specified by:
unbox in interface BoxedValue

box

public Object box(Object value)
This will box another object with the same annotations as this value.

Specified by:
box in interface BoxingStrategy
Parameters:
value - Value to box
Returns:
Value boxed with the annotations

getCollectionInheritableAnnotations

public Collection<Annotation> getCollectionInheritableAnnotations()

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getDescription

public final String getDescription()

toString

public String toString()
Delegates and returns the result of calling toString on the boxed value. This is unpleasant but necessary as Velocity uses the toString() result when context values are used as part of directive arguments.

Overrides:
toString in class Object
Returns:
String representation of wrapped value


Copyright © 2003-2012 Atlassian. All Rights Reserved.