Interface JType

All Known Subinterfaces:
JAnnotationType, JArrayType, JClassType, JEnumType, JGenericType, JParameterizedType, JRawType, JRealClassType, JTypeParameter, JWildcardType
All Known Implementing Classes:
JPrimitiveType

public interface JType
Super interface for types.
  • Method Details

    • getErasedType

      JType getErasedType()
      Returns this type with no type parameters or type variables. See the JLS Third Edition section on Type Erasure.
    • getJNISignature

      String getJNISignature()
      Returns the "field descriptor" for a type as specified by the Java Virtual Machine Specification. Examples:
      • boolean = Z
      • byte[] = [B
      • java.lang.String = Ljava/lang/String;
    • getLeafType

      JType getLeafType()
      For array types, recursively looks for the element type that is not an array. Otherwise, returns this type.
    • getParameterizedQualifiedSourceName

      String getParameterizedQualifiedSourceName()
      Returns a type name as it would be specified in Java source, with the package name included. Includes the type parameters. If called on a type parameter, does not include any bounds. For example, a type Foo declared in com.example would be given as "com.example.Foo", while the same type instantiated with Baz would be "com.example.Foo<com.example.Baz>".
    • getQualifiedBinaryName

      String getQualifiedBinaryName()
      A binary type name as specified by the Java Language Spec, ThirdEdition.
    • getQualifiedSourceName

      String getQualifiedSourceName()
      Returns a type name as it would be specified in Java source, with the package name included. Does not include the type parameters. If called on a type parameter, includes any bounds.
    • getSimpleSourceName

      String getSimpleSourceName()
      Returns the name of this class without the package name or enclosing class name.
    • isAnnotation

      JAnnotationType isAnnotation()
      Returns this instance as a JAnnotationType if it is an annotation or null if it is not.
    • isArray

      JArrayType isArray()
    • isClass

      JClassType isClass()
      Returns this instance if the erased version of this type is a class (as opposed to a primitive, array, or interface) or null if it is not.
    • isClassOrInterface

      JClassType isClassOrInterface()
      Returns this instance if the erased version of this type is a class or interface (as opposed to a primitive or array array) or null if it is not.
    • isEnum

      JEnumType isEnum()
      Returns this instance if it is an enumeration or null if it is not.
    • isGenericType

      JGenericType isGenericType()
      Returns this instance if it is a real class that has type parameters or null if it is not.
    • isInterface

      JClassType isInterface()
      Returns this instance if it is an interface or null if it is not.
    • isParameterized

      JParameterizedType isParameterized()
      Returns this instance as a JParameterizedType if it is a parameterized type or null if it is not.
    • isPrimitive

      JPrimitiveType isPrimitive()
    • isRawType

      JRawType isRawType()
      Returns the raw type if this is a JRawType, otherwise returns null.
    • isTypeParameter

      JTypeParameter isTypeParameter()
    • isWildcard

      JWildcardType isWildcard()