KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > lang > model > util > AbstractAnnotationValueVisitor6


1 /*
2  * @(#)AbstractAnnotationValueVisitor6.java 1.4 06/07/31
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.lang.model.util;
9
10
11 import java.util.List JavaDoc;
12 import javax.lang.model.element.*;
13
14 import javax.lang.model.type.TypeMirror;
15 import static javax.lang.model.SourceVersion.*;
16 import javax.lang.model.SourceVersion;
17 import javax.annotation.processing.SupportedSourceVersion;
18
19 /**
20  * A skeletal visitor for annotation values with default behavior
21  * appropriate for the {@link SourceVersion#RELEASE_6 RELEASE_6}
22  * source version.
23  *
24  * <p> <b>WARNING:</b> The {@code AnnotationValueVisitor} interface
25  * implemented by this class may have methods added to it in the
26  * future to accommodate new, currently unknown, language structures
27  * added to future versions of the Java&trade; programming language.
28  * Therefore, methods whose names begin with {@code "visit"} may be
29  * added to this class in the future; to avoid incompatibilities,
30  * classes which extend this class should not declare any instance
31  * methods with names beginning with {@code "visit"}.
32  *
33  * <p>When such a new visit method is added, the default
34  * implementation in this class will be to call the {@link
35  * #visitUnknown visitUnknown} method. A new abstract annotation
36  * value visitor class will also be introduced to correspond to the
37  * new language level; this visitor will have different default
38  * behavior for the visit method in question. When the new visitor is
39  * introduced, all or portions of this visitor may be deprecated.
40  *
41  * @param <R> the return type of this visitor's methods
42  * @param <P> the type of the additional parameter to this visitor's methods.
43  *
44  * @author Joseph D. Darcy
45  * @author Scott Seligman
46  * @author Peter von der Ah&eacute;
47  * @version 1.4 06/07/31
48  * @since 1.6
49  */

50 @SupportedSourceVersion(RELEASE_6)
51 public abstract class AbstractAnnotationValueVisitor6<R, P>
52     implements AnnotationValueVisitor<R, P> {
53
54     /**
55      * Constructor for concrete subclasses to call.
56      */

57     protected AbstractAnnotationValueVisitor6() {}
58
59     /**
60      * Visits an annotation value as if by passing itself to that
61      * value's {@link AnnotationValue#accept accept}. The invocation
62      * {@code v.visit(av)} is equivalent to {@code av.accept(v, p)}.
63      * @param av {@inheritDoc}
64      * @param p {@inheritDoc}
65      */

66     public final R visit(AnnotationValue av, P p) {
67     return av.accept(this, p);
68     }
69
70     /**
71      * Visits an annotation value as if by passing itself to that
72      * value's {@link AnnotationValue#accept accept} method passing
73      * {@code null} for the additional parameter. The invocation
74      * {@code v.visit(av)} is equivalent to {@code av.accept(v,
75      * null)}.
76      * @param av {@inheritDoc}
77      */

78     public final R visit(AnnotationValue av) {
79     return av.accept(this, null);
80     }
81
82     /**
83      * {@inheritDoc}
84      *
85      * <p>The default implementation of this method in {@code
86      * AbstractAnnotationValueVisitor6} will always throw {@code
87      * UnknownAnnotationValueException}. This behavior is not
88      * required of a subclass.
89      *
90      * @param av {@inheritDoc}
91      * @param p {@inheritDoc}
92      */

93     public R visitUnknown(AnnotationValue av, P p) {
94     throw new UnknownAnnotationValueException(av, p);
95     }
96 }
97
Popular Tags