01: package com.bm.ejb3metadata.annotations.analyzer;
02:
03: import org.ejb3unit.asm.AnnotationVisitor;
04:
05: /**
06: * This class manages the handling of single type like String name().
07: * @param <T> the type of annotation metadata.
08: * @param <V> the type of class / erasure (for values).
09: * @author Daniel Wiese
10: */
11: public abstract class ObjectAnnotationVisitor<T, V> extends
12: AbsAnnotationVisitor<T> implements AnnotationVisitor,
13: AnnotationType {
14:
15: /**
16: * Internal value in the given type.
17: */
18: private V value = null;
19:
20: /**
21: * Constructor.
22: * @param annotationMetadata linked to a metadata.
23: */
24: public ObjectAnnotationVisitor(final T annotationMetadata) {
25: super (annotationMetadata);
26: }
27:
28: /**
29: * Visits a primitive value of the annotation.
30: * @param name the value name.
31: * @param value the actual value, whose type must be {@link Byte},
32: * {@link Boolean}, {@link Character}, {@link Short},
33: * {@link Integer}, {@link Long}, {@link Float}, {@link Double},
34: * {@link String} or {@link org.ejb3unit.asm.Type}.
35: */
36: @Override
37: @SuppressWarnings("unchecked")
38: public void visit(final String name, final Object value) {
39: this .value = (V) value;
40: }
41:
42: /**
43: * @return value of the object
44: */
45: public V getValue() {
46: return this.value;
47: }
48:
49: }
|