| java.lang.Object org.apache.harmony.lang.annotation.AnnotationMember
AnnotationMember | public class AnnotationMember implements Serializable(Code) | | This class represents member element of an annotation.
It consists of name and value, supplemented with element
definition information (such as declared type of element).
The value may be one of the following types:
- boxed primitive
- Class
- enum constant
- annotation (nested)
- one-dimensional array of the above
- Throwable
The last type is specific for this implementation; a Throwable value
means that the error occured during parsing or resolution of corresponding
class-data structures and throwing is delayed until the element
is requested for value.
See Also: org.apache.harmony.lang.annotation.AnnotationFactory author: Alexey V. Varlamov, Serguei S. Zapreyev version: $Revision$ |
Field Summary | |
final protected static char | ARRAY Tag description of an array value type. | final protected static char | ERROR Tag description of a Throwable value type. | final protected static Object | NO_VALUE Singleton representing missing element value. | final protected static char | OTHER Tag description of all value types except arrays and Throwables. | protected transient Method | definingMethod | protected transient Class> | elementType | final protected String | name | final protected char | tag | final protected Object | value |
Method Summary | |
public Object | copyValue() Provides mutation-safe access to contained value. | public boolean | equalArrayValue(Object otherValue) Returns true if the contained value and a passed object are equal arrays,
false otherwise. | public boolean | equals(Object obj) Returns true if the specified object represents equal element
(equivalent name-value pair). | public int | hashCode() Computes hash code of this element. | public void | rethrowError() Throws contained error (if any) with a renewed stack trace. | protected AnnotationMember | setDefinition(AnnotationMember copy) Fills in element's definition info and returns this. | public String | toString() Returns readable description of this annotation value. | public Object | validateValue() Validates contained value against its member definition
and if ok returns the value.
Otherwise, if the value type mismatches definition
or the value itself describes an error,
throws appropriate exception.
Note, this method may return null if this element was constructed
with such value. |
ARRAY | final protected static char ARRAY(Code) | | Tag description of an array value type.
|
ERROR | final protected static char ERROR(Code) | | Tag description of a Throwable value type.
|
NO_VALUE | final protected static Object NO_VALUE(Code) | | Singleton representing missing element value.
|
OTHER | final protected static char OTHER(Code) | | Tag description of all value types except arrays and Throwables.
|
definingMethod | protected transient Method definingMethod(Code) | | |
elementType | protected transient Class> elementType(Code) | | |
tag | final protected char tag(Code) | | |
AnnotationMember | public AnnotationMember(String name, Object val)(Code) | | Creates a new element with specified name and value.
Definition info will be provided later when this
element becomes actual annotation member.
Parameters: name - element name, must not be null Parameters: val - element value, should be of addmissible type, as specified in the description of this class See Also: AnnotationMember.setDefinition(AnnotationMember) |
AnnotationMember | public AnnotationMember(String name, Object val, Class type, Method m)(Code) | | Creates the completely defined element.
Parameters: name - element name, must not be null Parameters: value - element value, should be of addmissible type, as specified in the description of this class Parameters: m - element-defining method, reflected on the annotation type Parameters: type - declared type of this element (return type of the defining method) |
copyValue | public Object copyValue() throws Throwable(Code) | | Provides mutation-safe access to contained value. That is, caller is free
to modify the returned value, it will not affect the contained data value.
cloned value if it is mutable or the original immutable value |
equalArrayValue | public boolean equalArrayValue(Object otherValue)(Code) | | Returns true if the contained value and a passed object are equal arrays,
false otherwise. Appropriate overloaded method of Arrays.equals()
is used for equality testing.
See Also: java.util.Arrays.equals(java.lang.Object[]java.lang.Object[]) true if the value is array and is equal to specified object,false otherwise |
rethrowError | public void rethrowError() throws Throwable(Code) | | Throws contained error (if any) with a renewed stack trace.
|
toString | public String toString()(Code) | | Returns readable description of this annotation value.
|
validateValue | public Object validateValue() throws Throwable(Code) | | Validates contained value against its member definition
and if ok returns the value.
Otherwise, if the value type mismatches definition
or the value itself describes an error,
throws appropriate exception.
Note, this method may return null if this element was constructed
with such value.
See Also: AnnotationMember.rethrowError() See Also: AnnotationMember.copyValue() actual valid value or null if no value |
|
|