Class TypeExpr

All Implemented Interfaces:
NodeWithRange<Node>, NodeWithTokenRange<Node>, NodeWithType<TypeExpr,​Type>, Observable, Visitable, HasParentNode<Node>, Cloneable

public class TypeExpr extends Expression implements NodeWithType<TypeExpr,​Type>
This class is just instantiated as scopes for MethodReferenceExpr nodes to encapsulate Types.
In World::greet the ClassOrInterfaceType "World" is wrapped in a TypeExpr before it is set as the scope of the MethodReferenceExpr.
Author:
Raquel Pau
  • Constructor Details

    • TypeExpr

      public TypeExpr()
    • TypeExpr

      public TypeExpr(Type type)
    • TypeExpr

      public TypeExpr(TokenRange tokenRange, Type type)
      This constructor is used by the parser and is considered private.
  • Method Details

    • accept

      public <R,​ A> R accept(GenericVisitor<R,​A> v, A arg)
      Description copied from interface: Visitable
      Accept method for visitor support.
      Specified by:
      accept in interface Visitable
      Type Parameters:
      R - the type of the return value of the visitor
      A - the type the user argument passed to the visitor
      Parameters:
      v - the visitor implementation
      arg - the argument passed to the visitor (of type A)
      Returns:
      the result of the visit (of type R)
    • accept

      public <A> void accept(VoidVisitor<A> v, A arg)
      Description copied from interface: Visitable
      Accept method for visitor support.
      Specified by:
      accept in interface Visitable
      Type Parameters:
      A - the type the argument passed for the visitor
      Parameters:
      v - the visitor implementation
      arg - any value relevant for the visitor (of type A)
    • getType

      public Type getType()
      Description copied from interface: NodeWithType
      Gets the type
      Specified by:
      getType in interface NodeWithType<TypeExpr,​Type>
      Returns:
      the type
    • setType

      public TypeExpr setType(Type type)
      Description copied from interface: NodeWithType
      Sets the type
      Specified by:
      setType in interface NodeWithType<TypeExpr,​Type>
      Parameters:
      type - the type
      Returns:
      this
    • clone

      public TypeExpr clone()
      Overrides:
      clone in class Expression
    • getMetaModel

      public TypeExprMetaModel getMetaModel()
      Overrides:
      getMetaModel in class Expression
      Returns:
      get JavaParser specific node introspection information.
    • replace

      public boolean replace(Node node, Node replacementNode)
      Overrides:
      replace in class Node
    • isTypeExpr

      public boolean isTypeExpr()
      Overrides:
      isTypeExpr in class Expression
    • asTypeExpr

      public TypeExpr asTypeExpr()
      Overrides:
      asTypeExpr in class Expression
    • ifTypeExpr

      public void ifTypeExpr(Consumer<TypeExpr> action)
      Overrides:
      ifTypeExpr in class Expression
    • toTypeExpr

      public Optional<TypeExpr> toTypeExpr()
      Overrides:
      toTypeExpr in class Expression