src/share/classes/javax/lang/model/element/ElementVisitor.java

Print this page




  45  * structures added to future versions of the Java™ programming
  46  * language.  Therefore, visitor classes directly implementing this
  47  * interface may be source incompatible with future versions of the
  48  * platform.  To avoid this source incompatibility, visitor
  49  * implementations are encouraged to instead extend the appropriate
  50  * abstract visitor class that implements this interface.  However, an
  51  * API should generally use this visitor interface as the type for
  52  * parameters, return type, etc. rather than one of the abstract
  53  * classes.
  54  *
  55  * @param <R> the return type of this visitor's methods.  Use {@link
  56  *            Void} for visitors that do not need to return results.
  57  * @param <P> the type of the additional parameter to this visitor's
  58  *            methods.  Use {@code Void} for visitors that do not need an
  59  *            additional parameter.
  60  *
  61  * @author Joseph D. Darcy
  62  * @author Scott Seligman
  63  * @author Peter von der Ah&eacute;
  64  * @see AbstractElementVisitor6

  65  * @since 1.6
  66  */
  67 public interface ElementVisitor<R, P> {
  68     /**
  69      * Visits an element.
  70      * @param e  the element to visit
  71      * @param p  a visitor-specified parameter
  72      * @return a visitor-specified result
  73      */
  74     R visit(Element e, P p);
  75 
  76     /**
  77      * A convenience method equivalent to {@code v.visit(e, null)}.
  78      * @param e  the element to visit
  79      * @return a visitor-specified result
  80      */
  81     R visit(Element e);
  82 
  83     /**
  84      * Visits a package element.




  45  * structures added to future versions of the Java&trade; programming
  46  * language.  Therefore, visitor classes directly implementing this
  47  * interface may be source incompatible with future versions of the
  48  * platform.  To avoid this source incompatibility, visitor
  49  * implementations are encouraged to instead extend the appropriate
  50  * abstract visitor class that implements this interface.  However, an
  51  * API should generally use this visitor interface as the type for
  52  * parameters, return type, etc. rather than one of the abstract
  53  * classes.
  54  *
  55  * @param <R> the return type of this visitor's methods.  Use {@link
  56  *            Void} for visitors that do not need to return results.
  57  * @param <P> the type of the additional parameter to this visitor's
  58  *            methods.  Use {@code Void} for visitors that do not need an
  59  *            additional parameter.
  60  *
  61  * @author Joseph D. Darcy
  62  * @author Scott Seligman
  63  * @author Peter von der Ah&eacute;
  64  * @see AbstractElementVisitor6
  65  * @see AbstractElementVisitor7
  66  * @since 1.6
  67  */
  68 public interface ElementVisitor<R, P> {
  69     /**
  70      * Visits an element.
  71      * @param e  the element to visit
  72      * @param p  a visitor-specified parameter
  73      * @return a visitor-specified result
  74      */
  75     R visit(Element e, P p);
  76 
  77     /**
  78      * A convenience method equivalent to {@code v.visit(e, null)}.
  79      * @param e  the element to visit
  80      * @return a visitor-specified result
  81      */
  82     R visit(Element e);
  83 
  84     /**
  85      * Visits a package element.