< prev index next >

## src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeVisitor.java

Print this page

      28 /**
      29  * A visitor of trees, in the style of the visitor design pattern.
      30  * Classes implementing this interface are used to operate
      31  * on a tree when the kind of tree is unknown at compile time.
      32  * When a visitor is passed to an tree's {@link Tree#accept
      33  * accept} method, the <code>visit<i>Xyz</i></code> method most applicable
      34  * to that tree is invoked.
      35  *
      36  * <p> Classes implementing this interface may or may not throw a
      37  * {@code NullPointerException} if the additional parameter {@code p}
      38  * is {@code null}; see documentation of the implementing class for
      39  * details.
      40  *
      41  * <p> <b>WARNING:</b> It is possible that methods will be added to
      42  this interface to accommodate new, currently unknown, language
      43  structures added to future versions of the ECMAScript programming
      44  language. When new visit methods are added for new Tree subtypes,
      45  default method bodies will be introduced which will call visitUnknown
      46  method as a fallback.
      47  *

      48  * @param <R> the return type of this visitor's methods.  Use {@link
      49  *            Void} for visitors that do not need to return results.
      50  * @param <P> the type of the additional parameter to this visitor's
      51  *            methods.  Use {@code Void} for visitors that do not need an
      52  *            additional parameter.
      53  *
      54  * @since 9
      55  */

      56 public interface TreeVisitor<R,P> {
      57     /**
      58      * Visit assignment tree.
      59      *
      60      * @param node node being visited
      61      * @param p extra parameter passed to the visitor
      62      * @return value from the visitor
      63      */
      64     R visitAssignment(AssignmentTree node, P p);
      65
      66     /**
      67      * Visit compound assignment tree.
      68      *
      69      * @param node node being visited
      70      * @param p extra parameter passed to the visitor
      71      * @return value from the visitor
      72      */
      73     R visitCompoundAssignment(CompoundAssignmentTree node, P p);
      74
      75     /**
      28 /**
      29  * A visitor of trees, in the style of the visitor design pattern.
      30  * Classes implementing this interface are used to operate
      31  * on a tree when the kind of tree is unknown at compile time.
      32  * When a visitor is passed to an tree's {@link Tree#accept
      33  * accept} method, the <code>visit<i>Xyz</i></code> method most applicable
      34  * to that tree is invoked.
      35  *
      36  * <p> Classes implementing this interface may or may not throw a
      37  * {@code NullPointerException} if the additional parameter {@code p}
      38  * is {@code null}; see documentation of the implementing class for
      39  * details.
      40  *
      41  * <p> <b>WARNING:</b> It is possible that methods will be added to
      42  this interface to accommodate new, currently unknown, language
      43  structures added to future versions of the ECMAScript programming
      44  language. When new visit methods are added for new Tree subtypes,
      45  default method bodies will be introduced which will call visitUnknown
      46  method as a fallback.
      47  *
      48  * @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
      49  * are deprecated with the intent to remove them in a future release.
      50  *
      51  * @param <R> the return type of this visitor's methods.  Use {@link
      52  *            Void} for visitors that do not need to return results.
      53  * @param <P> the type of the additional parameter to this visitor's
      54  *            methods.  Use {@code Void} for visitors that do not need an
      55  *            additional parameter.
      56  *
      57  * @since 9
      58  */
      59 @Deprecated(since="11", forRemoval=true)
      60 public interface TreeVisitor<R,P> {
      61     /**
      62      * Visit assignment tree.
      63      *
      64      * @param node node being visited
      65      * @param p extra parameter passed to the visitor
      66      * @return value from the visitor
      67      */
      68     R visitAssignment(AssignmentTree node, P p);
      69
      70     /**
      71      * Visit compound assignment tree.
      72      *
      73      * @param node node being visited
      74      * @param p extra parameter passed to the visitor
      75      * @return value from the visitor
      76      */
      77     R visitCompoundAssignment(CompoundAssignmentTree node, P p);
      78
      79     /**

< prev index next >