Class SimpleType


public class SimpleType extends AnnotatableType
Type node for a named class type, a named interface type, or a type variable.
 SimpleType:
    { Annotation } TypeName
 

This kind of node is used to convert a name (Name) into a type (Type) by wrapping it.

In JLS8 and later, the SimpleType may have optional annotations. If annotations are present, then the name must be a SimpleName. Annotated qualified names are represented as QualifiedType or NameQualifiedType.
Since:
2.0
See Also:
Restriction:
This class is not intended to be instantiated by clients.
  • Field Details

    • ANNOTATIONS_PROPERTY

      public static final ChildListPropertyDescriptor ANNOTATIONS_PROPERTY
      The "annotations" structural property of this node type (element type: Annotation).
      Since:
      3.10
    • NAME_PROPERTY

      public static final ChildPropertyDescriptor NAME_PROPERTY
      The "name" structural property of this node type (child type: Name).
      Since:
      3.0
  • Method Details

    • propertyDescriptors

      public static List propertyDescriptors(int apiLevel)
      Returns a list of structural property descriptors for this node type. Clients must not modify the result.
      Parameters:
      apiLevel - the API level; one of the AST.JLS* constants
      Returns:
      a list of property descriptors (element type: StructuralPropertyDescriptor)
      Since:
      3.0
    • getName

      public Name getName()
      Returns the name of this simple type.
      Returns:
      the name of this simple type
    • setName

      public void setName(Name typeName)
      Sets the name of this simple type to the given name.
      Parameters:
      typeName - the new name of this simple type
      Throws:
      IllegalArgumentException - if:
      • the node belongs to a different AST
      • the node already has a parent
    • isVar

      public boolean isVar()
      Description copied from class: Type
      Returns whether this type is a var. The convenience method checks whether the type is so named.
      Overrides:
      isVar in class Type
      Returns:
      true if this is a var, and false otherwise
      Throws:
      UnsupportedOperationException - if this operation is used below JLS10
      Since:
      3.14