KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > deployment > annotations > analyzer > AbsAnnotationVisitor


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: AbsAnnotationVisitor.java 9 2006-02-19 18:53:32Z benoitf $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.easybeans.deployment.annotations.analyzer;
27
28 import org.objectweb.asm.AnnotationVisitor;
29
30 /**
31  * This class manages the setter/getter of annotation visitor.
32  * @param <T> a metadata object.
33  * @author Florent Benoit
34  */

35 public abstract class AbsAnnotationVisitor<T> implements AnnotationVisitor, AnnotationType {
36
37     /**
38      * Linked to an AnnotationMetadata ?
39      */

40     private T annotationMetadata;
41
42     /**
43      * Constructor (default).
44      */

45     public AbsAnnotationVisitor() {
46
47     }
48
49     /**
50      * Constructor.
51      * @param annotationMetadata linked to an annotation metadata
52      */

53     public AbsAnnotationVisitor(final T annotationMetadata) {
54         this();
55         this.annotationMetadata = annotationMetadata;
56     }
57
58     /**
59      * Visits a primitive value of the annotation.
60      * @param name the value name.
61      * @param value the actual value, whose type must be {@link Byte},
62      * {@link Boolean}, {@link Character}, {@link Short},
63      * {@link Integer}, {@link Long}, {@link Float}, {@link Double},
64      * {@link String} or {@link org.objectweb.asm.Type}.
65      */

66     public void visit(final String JavaDoc name, final Object JavaDoc value) {
67
68     }
69
70     /**
71      * Visits an enumeration value of the annotation.
72      * @param name the value name.
73      * @param desc the class descriptor of the enumeration class.
74      * @param value the actual enumeration value.
75      */

76     public void visitEnum(final String JavaDoc name, final String JavaDoc desc, final String JavaDoc value) {
77
78     }
79
80     /**
81      * Visits a nested annotation value of the annotation.
82      * @param name the value name.
83      * @param desc the class descriptor of the nested annotation class.
84      * @return a non null visitor to visit the actual nested annotation value.
85      * <i>The nested annotation value must be fully visited before
86      * calling other methods on this annotation visitor</i>.
87      */

88     public AnnotationVisitor visitAnnotation(final String JavaDoc name, final String JavaDoc desc) {
89         return this;
90     }
91
92     /**
93      * Visits an array value of the annotation.
94      * @param name the value name.
95      * @return a non null visitor to visit the actual array value elements. The
96      * 'name' parameters passed to the methods of this visitor are
97      * ignored. <i>All the array values must be visited before calling
98      * other methods on this annotation visitor</i>.
99      */

100     public AnnotationVisitor visitArray(final String JavaDoc name) {
101         return this;
102     }
103
104     /**
105      * Visits the end of the annotation.
106      */

107     public abstract void visitEnd();
108
109
110     /**
111      * @return class/method metadata
112      */

113     public T getAnnotationMetadata() {
114         return annotationMetadata;
115     }
116
117
118
119 }
120
Popular Tags