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, java.lang.reflect.AnnotatedElement

public final class AnnotatedValue<E>
extends java.lang.Object
implements AnnotationBoxedElement<E>

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


Constructor Summary
AnnotatedValue(E value, java.util.Collection<java.lang.annotation.Annotation> annotations)
          Construct a new annotated value.
 
Method Summary
 java.lang.Object box(java.lang.Object value)
          This will box another object with the same annotations as this value.
 boolean equals(java.lang.Object o)
           
<T extends java.lang.annotation.Annotation>
T
getAnnotation(java.lang.Class<T> tClass)
           
 java.util.Collection<java.lang.annotation.Annotation> getAnnotationCollection()
           
 java.lang.annotation.Annotation[] getAnnotations()
           
 java.util.Collection<java.lang.annotation.Annotation> getCollectionInheritableAnnotations()
           
 java.lang.annotation.Annotation[] getDeclaredAnnotations()
           
 java.lang.String getDescription()
           
<T extends java.lang.annotation.Annotation>
boolean
hasAnnotation(java.lang.Class<T> tClass)
           
 int hashCode()
           
 boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> aClass)
           
 java.lang.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,
                      java.util.Collection<java.lang.annotation.Annotation> annotations)
Construct a new annotated value.

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

isAnnotationPresent

public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> aClass)
Specified by:
isAnnotationPresent in interface java.lang.reflect.AnnotatedElement

getAnnotation

public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> tClass)
Specified by:
getAnnotation in interface java.lang.reflect.AnnotatedElement

hasAnnotation

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

getAnnotations

public java.lang.annotation.Annotation[] getAnnotations()
Specified by:
getAnnotations in interface java.lang.reflect.AnnotatedElement

getDeclaredAnnotations

public java.lang.annotation.Annotation[] getDeclaredAnnotations()
Specified by:
getDeclaredAnnotations in interface java.lang.reflect.AnnotatedElement

getAnnotationCollection

public java.util.Collection<java.lang.annotation.Annotation> getAnnotationCollection()
Specified by:
getAnnotationCollection in interface AnnotationBoxedElement<E>

unbox

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

box

public java.lang.Object box(java.lang.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 java.util.Collection<java.lang.annotation.Annotation> getCollectionInheritableAnnotations()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getDescription

public final java.lang.String getDescription()

toString

public java.lang.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 java.lang.Object
Returns:
String representation of wrapped value


Copyright © 2013 Atlassian. All Rights Reserved.