001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: AbsAnnotationVisitor.java 2059 2007-11-22 17:22:33Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.deployment.annotations.analyzer;
025:
026: import org.ow2.easybeans.asm.AnnotationVisitor;
027:
028: /**
029: * This class manages the setter/getter of annotation visitor.
030: * @param <T> a metadata object.
031: * @author Florent Benoit
032: */
033: public abstract class AbsAnnotationVisitor<T> implements
034: AnnotationVisitor, AnnotationType {
035:
036: /**
037: * Linked to an AnnotationMetadata ?
038: */
039: private T annotationMetadata;
040:
041: /**
042: * Constructor (default).
043: */
044: public AbsAnnotationVisitor() {
045:
046: }
047:
048: /**
049: * Constructor.
050: * @param annotationMetadata linked to an annotation metadata
051: */
052: public AbsAnnotationVisitor(final T annotationMetadata) {
053: this ();
054: this .annotationMetadata = annotationMetadata;
055: }
056:
057: /**
058: * Visits a primitive value of the annotation.
059: * @param name the value name.
060: * @param value the actual value, whose type must be {@link Byte},
061: * {@link Boolean}, {@link Character}, {@link Short},
062: * {@link Integer}, {@link Long}, {@link Float}, {@link Double},
063: * {@link String} or {@link org.ow2.easybeans.asm.Type}.
064: */
065: public void visit(final String name, final Object value) {
066:
067: }
068:
069: /**
070: * Visits an enumeration value of the annotation.
071: * @param name the value name.
072: * @param desc the class descriptor of the enumeration class.
073: * @param value the actual enumeration value.
074: */
075: public void visitEnum(final String name, final String desc,
076: final String value) {
077:
078: }
079:
080: /**
081: * Visits a nested annotation value of the annotation.
082: * @param name the value name.
083: * @param desc the class descriptor of the nested annotation class.
084: * @return a non null visitor to visit the actual nested annotation value.
085: * <i>The nested annotation value must be fully visited before
086: * calling other methods on this annotation visitor</i>.
087: */
088: public AnnotationVisitor visitAnnotation(final String name,
089: final String desc) {
090: return this ;
091: }
092:
093: /**
094: * Visits an array value of the annotation.
095: * @param name the value name.
096: * @return a non null visitor to visit the actual array value elements. The
097: * 'name' parameters passed to the methods of this visitor are
098: * ignored. <i>All the array values must be visited before calling
099: * other methods on this annotation visitor</i>.
100: */
101: public AnnotationVisitor visitArray(final String name) {
102: return this ;
103: }
104:
105: /**
106: * Visits the end of the annotation.
107: */
108: public abstract void visitEnd();
109:
110: /**
111: * @return class/method metadata
112: */
113: public T getAnnotationMetadata() {
114: return annotationMetadata;
115: }
116:
117: }
|