001: package com.bm.ejb3metadata.annotations.analyzer;
002:
003: import org.ejb3unit.asm.AnnotationVisitor;
004:
005: /**
006: * This class manages the setter/getter of annotation visitor.
007: *
008: * @param <T>
009: * a metadata object.
010: * @author Daniel Wiese
011: */
012: public abstract class AbsAnnotationVisitor<T> implements
013: AnnotationVisitor, AnnotationType {
014:
015: /**
016: * Linked to an AnnotationMetadata ?
017: */
018: private T annotationMetadata;
019:
020: /**
021: * Constructor (default).
022: */
023: public AbsAnnotationVisitor() {
024:
025: }
026:
027: /**
028: * Constructor.
029: *
030: * @param annotationMetadata
031: * linked to an annotation metadata
032: */
033: public AbsAnnotationVisitor(final T annotationMetadata) {
034: this ();
035: this .annotationMetadata = annotationMetadata;
036: }
037:
038: /**
039: * Visits a primitive value of the annotation.
040: *
041: * @param name
042: * the value name.
043: * @param value
044: * the actual value, whose type must be {@link Byte},
045: * {@link Boolean}, {@link Character}, {@link Short},
046: * {@link Integer}, {@link Long}, {@link Float},
047: * {@link Double}, {@link String} or
048: * {@link org.ejb3unit.asm.Type}.
049: */
050: public void visit(final String name, final Object value) {
051:
052: }
053:
054: /**
055: * Visits an enumeration value of the annotation.
056: *
057: * @param name
058: * the value name.
059: * @param desc
060: * the class descriptor of the enumeration class.
061: * @param value
062: * the actual enumeration value.
063: */
064: public void visitEnum(final String name, final String desc,
065: final String value) {
066:
067: }
068:
069: /**
070: * Visits a nested annotation value of the annotation.
071: *
072: * @param name
073: * the value name.
074: * @param desc
075: * the class descriptor of the nested annotation class.
076: * @return a non null visitor to visit the actual nested annotation value.
077: * <i>The nested annotation value must be fully visited before
078: * calling other methods on this annotation visitor</i>.
079: */
080: public AnnotationVisitor visitAnnotation(final String name,
081: final String desc) {
082: return this ;
083: }
084:
085: /**
086: * Visits an array value of the annotation.
087: *
088: * @param name
089: * the value name.
090: * @return a non null visitor to visit the actual array value elements. The
091: * 'name' parameters passed to the methods of this visitor are
092: * ignored. <i>All the array values must be visited before calling
093: * other methods on this annotation visitor</i>.
094: */
095: public AnnotationVisitor visitArray(final String name) {
096: return this ;
097: }
098:
099: /**
100: * Visits the end of the annotation.
101: */
102: public abstract void visitEnd();
103:
104: /**
105: * class/method metadata.
106: *
107: * @return class/method metadata
108: */
109: public T getAnnotationMetadata() {
110: return annotationMetadata;
111: }
112:
113: }
|