src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Tree.java

Print this page




 513          * a string literal expression of type {@link String}.
 514          */
 515         STRING_LITERAL(LiteralTree.class),
 516 
 517         /**
 518          * Used for instances of {@link LiteralTree} representing
 519          * the use of {@code null}.
 520          */
 521         NULL_LITERAL(LiteralTree.class),
 522 
 523         /**
 524          * An implementation-reserved node. This is the not the node
 525          * you are looking for.
 526          */
 527         OTHER(null);
 528 
 529         Kind(Class<? extends Tree> intf) {
 530             associatedInterface = intf;
 531         }
 532 




 533         public Class<? extends Tree> asInterface() {
 534             return associatedInterface;
 535         }
 536 
 537         /**
 538          * Returns if this is a literal tree kind or not.
 539          *
 540          * @return true if this is a literal tree kind, false otherwise
 541          */
 542         public boolean isLiteral() {
 543             return associatedInterface == LiteralTree.class;
 544         }
 545 
 546         /**
 547          * Returns if this is an expression tree kind or not.
 548          *
 549          * @return true if this is an expression tree kind, false otherwise
 550          */
 551         public boolean isExpression() {
 552             return ExpressionTree.class.isAssignableFrom(associatedInterface);




 513          * a string literal expression of type {@link String}.
 514          */
 515         STRING_LITERAL(LiteralTree.class),
 516 
 517         /**
 518          * Used for instances of {@link LiteralTree} representing
 519          * the use of {@code null}.
 520          */
 521         NULL_LITERAL(LiteralTree.class),
 522 
 523         /**
 524          * An implementation-reserved node. This is the not the node
 525          * you are looking for.
 526          */
 527         OTHER(null);
 528 
 529         Kind(Class<? extends Tree> intf) {
 530             associatedInterface = intf;
 531         }
 532 
 533        /**
 534         * Returns the associated interface type that uses this kind.
 535         * @return the associated interface
 536         */
 537         public Class<? extends Tree> asInterface() {
 538             return associatedInterface;
 539         }
 540 
 541         /**
 542          * Returns if this is a literal tree kind or not.
 543          *
 544          * @return true if this is a literal tree kind, false otherwise
 545          */
 546         public boolean isLiteral() {
 547             return associatedInterface == LiteralTree.class;
 548         }
 549 
 550         /**
 551          * Returns if this is an expression tree kind or not.
 552          *
 553          * @return true if this is an expression tree kind, false otherwise
 554          */
 555         public boolean isExpression() {
 556             return ExpressionTree.class.isAssignableFrom(associatedInterface);