Enum JPrimitiveType

  • All Implemented Interfaces:
    JType, java.io.Serializable, java.lang.Comparable<JPrimitiveType>

    public enum JPrimitiveType
    extends java.lang.Enum<JPrimitiveType>
    implements JType
    Represents a primitive type in a declaration.
    • Method Detail

      • values

        public static JPrimitiveType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (JPrimitiveType c : JPrimitiveType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static JPrimitiveType valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • parse

        public static JPrimitiveType parse​(java.lang.String name)
      • getErasedType

        public JType getErasedType()
        Description copied from interface: JType
        Returns this type with no type parameters or type variables. See the JLS Third Edition section on Type Erasure.
        Specified by:
        getErasedType in interface JType
      • getJNISignature

        public java.lang.String getJNISignature()
        Description copied from interface: JType
        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;
        Specified by:
        getJNISignature in interface JType
      • getLeafType

        public JType getLeafType()
        Description copied from interface: JType
        For array types, recursively looks for the element type that is not an array. Otherwise, returns this type.
        Specified by:
        getLeafType in interface JType
      • getParameterizedQualifiedSourceName

        public java.lang.String getParameterizedQualifiedSourceName()
        Description copied from interface: JType
        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".
        Specified by:
        getParameterizedQualifiedSourceName in interface JType
      • getQualifiedBoxedSourceName

        public java.lang.String getQualifiedBoxedSourceName()
      • getQualifiedSourceName

        public java.lang.String getQualifiedSourceName()
        Description copied from interface: JType
        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.
        Specified by:
        getQualifiedSourceName in interface JType
      • getSimpleSourceName

        public java.lang.String getSimpleSourceName()
        Description copied from interface: JType
        Returns the name of this class without the package name or enclosing class name.
        Specified by:
        getSimpleSourceName in interface JType
      • getUninitializedFieldExpression

        public java.lang.String getUninitializedFieldExpression()
      • isClass

        public JClassType isClass()
        Description copied from interface: JType
        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.
        Specified by:
        isClass in interface JType
      • isClassOrInterface

        public JClassType isClassOrInterface()
        Description copied from interface: JType
        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.
        Specified by:
        isClassOrInterface in interface JType
      • isEnum

        public JEnumType isEnum()
        Description copied from interface: JType
        Returns this instance if it is an enumeration or null if it is not.
        Specified by:
        isEnum in interface JType
      • isGenericType

        public JGenericType isGenericType()
        Description copied from interface: JType
        Returns this instance if it is a real class that has type parameters or null if it is not.
        Specified by:
        isGenericType in interface JType
      • isInterface

        public JClassType isInterface()
        Description copied from interface: JType
        Returns this instance if it is an interface or null if it is not.
        Specified by:
        isInterface in interface JType
      • isRawType

        public JRawType isRawType()
        Description copied from interface: JType
        Returns the raw type if this is a JRawType, otherwise returns null.
        Specified by:
        isRawType in interface JType
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Enum<JPrimitiveType>