< prev index next >

src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java

Print this page




  66  * <p>Note that adding a default implementation of a new visit method
  67  * in a visitor class will occur instead of adding a <em>default
  68  * method</em> directly in the visitor interface since a Java SE 8
  69  * language feature cannot be used to this version of the API since
  70  * this version is required to be runnable on Java SE 7
  71  * implementations.  Future versions of the API that are only required
  72  * to run on Java SE 8 and later may take advantage of default methods
  73  * in this situation.
  74  *
  75  * @param <R> the return type of this visitor's methods
  76  * @param <P> the type of the additional parameter to this visitor's methods.
  77  *
  78  * @author Joseph D. Darcy
  79  * @author Scott Seligman
  80  * @author Peter von der Ah&eacute;
  81  *
  82  * @see SimpleAnnotationValueVisitor7
  83  * @see SimpleAnnotationValueVisitor8
  84  * @see SimpleAnnotationValueVisitor9
  85  * @since 1.6
  86  * @deprecated Release 6 is obsolete; update to a visitor for a newer
  87  * release level.
  88  */
  89 @Deprecated
  90 @SupportedSourceVersion(RELEASE_6)
  91 public class SimpleAnnotationValueVisitor6<R, P>
  92     extends AbstractAnnotationValueVisitor6<R, P> {
  93 
  94     /**
  95      * Default value to be returned; {@link #defaultAction
  96      * defaultAction} returns this value unless the method is
  97      * overridden.
  98      */
  99     protected final R DEFAULT_VALUE;
 100 
 101     /**
 102      * Constructor for concrete subclasses; uses {@code null} for the
 103      * default value.


 104      */

 105     protected SimpleAnnotationValueVisitor6() {
 106         super();
 107         DEFAULT_VALUE = null;
 108     }
 109 
 110     /**
 111      * Constructor for concrete subclasses; uses the argument for the
 112      * default value.
 113      *
 114      * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}


 115      */

 116     protected SimpleAnnotationValueVisitor6(R defaultValue) {
 117         super();
 118         DEFAULT_VALUE = defaultValue;
 119     }
 120 
 121     /**
 122      * The default action for visit methods.  The implementation in
 123      * this class just returns {@link #DEFAULT_VALUE}; subclasses will
 124      * commonly override this method.
 125      *
 126      * @param o the value of the annotation
 127      * @param p a visitor-specified parameter
 128      * @return {@code DEFAULT_VALUE} unless overridden
 129      */
 130     protected R defaultAction(Object o, P p) {
 131         return DEFAULT_VALUE;
 132     }
 133 
 134     /**
 135      * {@inheritDoc} This implementation calls {@code defaultAction}.




  66  * <p>Note that adding a default implementation of a new visit method
  67  * in a visitor class will occur instead of adding a <em>default
  68  * method</em> directly in the visitor interface since a Java SE 8
  69  * language feature cannot be used to this version of the API since
  70  * this version is required to be runnable on Java SE 7
  71  * implementations.  Future versions of the API that are only required
  72  * to run on Java SE 8 and later may take advantage of default methods
  73  * in this situation.
  74  *
  75  * @param <R> the return type of this visitor's methods
  76  * @param <P> the type of the additional parameter to this visitor's methods.
  77  *
  78  * @author Joseph D. Darcy
  79  * @author Scott Seligman
  80  * @author Peter von der Ah&eacute;
  81  *
  82  * @see SimpleAnnotationValueVisitor7
  83  * @see SimpleAnnotationValueVisitor8
  84  * @see SimpleAnnotationValueVisitor9
  85  * @since 1.6


  86  */

  87 @SupportedSourceVersion(RELEASE_6)
  88 public class SimpleAnnotationValueVisitor6<R, P>
  89     extends AbstractAnnotationValueVisitor6<R, P> {
  90 
  91     /**
  92      * Default value to be returned; {@link #defaultAction
  93      * defaultAction} returns this value unless the method is
  94      * overridden.
  95      */
  96     protected final R DEFAULT_VALUE;
  97 
  98     /**
  99      * Constructor for concrete subclasses; uses {@code null} for the
 100      * default value.
 101      * @deprecated Release 6 is obsolete; update to a visitor for a newer
 102      * release level.
 103      */
 104     @Deprecated
 105     protected SimpleAnnotationValueVisitor6() {
 106         super();
 107         DEFAULT_VALUE = null;
 108     }
 109 
 110     /**
 111      * Constructor for concrete subclasses; uses the argument for the
 112      * default value.
 113      *
 114      * @param defaultValue the value to assign to {@link #DEFAULT_VALUE}
 115      * @deprecated Release 6 is obsolete; update to a visitor for a newer
 116      * release level.
 117      */
 118     @Deprecated
 119     protected SimpleAnnotationValueVisitor6(R defaultValue) {
 120         super();
 121         DEFAULT_VALUE = defaultValue;
 122     }
 123 
 124     /**
 125      * The default action for visit methods.  The implementation in
 126      * this class just returns {@link #DEFAULT_VALUE}; subclasses will
 127      * commonly override this method.
 128      *
 129      * @param o the value of the annotation
 130      * @param p a visitor-specified parameter
 131      * @return {@code DEFAULT_VALUE} unless overridden
 132      */
 133     protected R defaultAction(Object o, P p) {
 134         return DEFAULT_VALUE;
 135     }
 136 
 137     /**
 138      * {@inheritDoc} This implementation calls {@code defaultAction}.


< prev index next >