Interface NodeWithType<N extends Node,​T extends Type>

All Known Implementing Classes:
AnnotationMemberDeclaration, CastExpr, ClassExpr, InstanceOfExpr, MethodDeclaration, ObjectCreationExpr, Parameter, PatternExpr, ReceiverParameter, TypeExpr, VariableDeclarator

public interface NodeWithType<N extends Node,​T extends Type>
A node with a type.

The main reason for this interface is to permit users to manipulate homogeneously all nodes with getType/setType methods

Since:
2.3.1
  • Method Details

    • getType

      T getType()
      Gets the type
      Returns:
      the type
    • setType

      N setType(T type)
      Sets the type
      Parameters:
      type - the type
      Returns:
      this
    • tryAddImportToParentCompilationUnit

      void tryAddImportToParentCompilationUnit(Class<?> clazz)
    • setType

      default N setType(Class<?> typeClass)
      Sets this type to this class and try to import it to the CompilationUnit if needed
      Parameters:
      typeClass - the type
      Returns:
      this
    • setType

      default N setType(String typeString)
    • getTypeAsString

      default String getTypeAsString()