com.atlassian.velocity.htmlsafe.introspection
Class AnnotatedValue<E>

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

public final class AnnotatedValue<E>
extends Object
implements AnnotationBoxedElement<E>

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


Constructor Summary
AnnotatedValue(E 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)
           
 Collection<Annotation> getAnnotationCollection()
           
 Annotation[] getAnnotations()
           
 Collection<Annotation> getCollectionInheritableAnnotations()
           
 Annotation[] getDeclaredAnnotations()
           
 String getDescription()
           
<T extends Annotation>
boolean
hasAnnotation(Class<T> tClass)
           
 int hashCode()
           
 boolean isAnnotationPresent(Class<? extends Annotation> aClass)
           
 String toString()
          Delegates and returns the result of calling toString on the boxed value.
 E unbox()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnnotatedValue

public AnnotatedValue(E value,
                      Collection<Annotation> annotations)
Construct a new annotated value.

Parameters:
value - The value to annotate
annotations - This value's 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

hasAnnotation

public <T extends Annotation> boolean hasAnnotation(Class<T> tClass)
Specified by:
hasAnnotation in interface AnnotationBoxedElement<E>

getAnnotations

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

getDeclaredAnnotations

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

getAnnotationCollection

public Collection<Annotation> getAnnotationCollection()
Specified by:
getAnnotationCollection in interface AnnotationBoxedElement<E>

unbox

public E unbox()
Specified by:
unbox in interface BoxedValue<E>

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 © 2014 Atlassian. All Rights Reserved.