Package com.google.gwt.core.ext.typeinfo
Enum JPrimitiveType
- java.lang.Object
-
- java.lang.Enum<JPrimitiveType>
-
- com.google.gwt.core.ext.typeinfo.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JTypegetErasedType()Returns this type with no type parameters or type variables.java.lang.StringgetJNISignature()Returns the "field descriptor" for a type as specified by the Java Virtual Machine Specification.JTypegetLeafType()For array types, recursively looks for the element type that is not an array.java.lang.StringgetParameterizedQualifiedSourceName()Returns a type name as it would be specified in Java source, with the package name included.java.lang.StringgetQualifiedBinaryName()A binary type name as specified by the Java Language Spec, ThirdEdition.java.lang.StringgetQualifiedBoxedSourceName()java.lang.StringgetQualifiedSourceName()Returns a type name as it would be specified in Java source, with the package name included.java.lang.StringgetSimpleSourceName()Returns the name of this class without the package name or enclosing class name.java.lang.StringgetUninitializedFieldExpression()JAnnotationTypeisAnnotation()Returns this instance as aJAnnotationTypeif it is an annotation ornullif it is not.JArrayTypeisArray()JClassTypeisClass()Returns this instance if the erased version of this type is a class (as opposed to a primitive, array, or interface) ornullif it is not.JClassTypeisClassOrInterface()Returns this instance if the erased version of this type is a class or interface (as opposed to a primitive or array array) ornullif it is not.JEnumTypeisEnum()Returns this instance if it is an enumeration ornullif it is not.JGenericTypeisGenericType()Returns this instance if it is a real class that has type parameters ornullif it is not.JClassTypeisInterface()Returns this instance if it is an interface ornullif it is not.JParameterizedTypeisParameterized()Returns this instance as aJParameterizedTypeif it is a parameterized type ornullif it is not.JPrimitiveTypeisPrimitive()JRawTypeisRawType()Returns the raw type if this is aJRawType, otherwise returnsnull.JTypeParameterisTypeParameter()JWildcardTypeisWildcard()static JPrimitiveTypeparse(java.lang.String name)java.lang.StringtoString()static JPrimitiveTypevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static JPrimitiveType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
BOOLEAN
public static final JPrimitiveType BOOLEAN
-
BYTE
public static final JPrimitiveType BYTE
-
CHAR
public static final JPrimitiveType CHAR
-
DOUBLE
public static final JPrimitiveType DOUBLE
-
FLOAT
public static final JPrimitiveType FLOAT
-
INT
public static final JPrimitiveType INT
-
LONG
public static final JPrimitiveType LONG
-
SHORT
public static final JPrimitiveType SHORT
-
VOID
public static final JPrimitiveType VOID
-
-
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 namejava.lang.NullPointerException- if the argument is null
-
parse
public static JPrimitiveType parse(java.lang.String name)
-
getErasedType
public JType getErasedType()
Description copied from interface:JTypeReturns this type with no type parameters or type variables. See the JLS Third Edition section on Type Erasure.- Specified by:
getErasedTypein interfaceJType
-
getJNISignature
public java.lang.String getJNISignature()
Description copied from interface:JTypeReturns 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:
getJNISignaturein interfaceJType
- boolean =
-
getLeafType
public JType getLeafType()
Description copied from interface:JTypeFor array types, recursively looks for the element type that is not an array. Otherwise, returns this type.- Specified by:
getLeafTypein interfaceJType
-
getParameterizedQualifiedSourceName
public java.lang.String getParameterizedQualifiedSourceName()
Description copied from interface:JTypeReturns 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 Foodeclared in com.example would be given as "com.example.Foo ", while the same type instantiated with Baz would be "com.example.Foo ". - Specified by:
getParameterizedQualifiedSourceNamein interfaceJType
-
getQualifiedBinaryName
public java.lang.String getQualifiedBinaryName()
Description copied from interface:JTypeA binary type name as specified by the Java Language Spec, ThirdEdition.- Specified by:
getQualifiedBinaryNamein interfaceJType
-
getQualifiedBoxedSourceName
public java.lang.String getQualifiedBoxedSourceName()
-
getQualifiedSourceName
public java.lang.String getQualifiedSourceName()
Description copied from interface:JTypeReturns 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:
getQualifiedSourceNamein interfaceJType
-
getSimpleSourceName
public java.lang.String getSimpleSourceName()
Description copied from interface:JTypeReturns the name of this class without the package name or enclosing class name.- Specified by:
getSimpleSourceNamein interfaceJType
-
getUninitializedFieldExpression
public java.lang.String getUninitializedFieldExpression()
-
isAnnotation
public JAnnotationType isAnnotation()
Description copied from interface:JTypeReturns this instance as aJAnnotationTypeif it is an annotation ornullif it is not.- Specified by:
isAnnotationin interfaceJType
-
isArray
public JArrayType isArray()
-
isClass
public JClassType isClass()
Description copied from interface:JTypeReturns this instance if the erased version of this type is a class (as opposed to a primitive, array, or interface) ornullif it is not.
-
isClassOrInterface
public JClassType isClassOrInterface()
Description copied from interface:JTypeReturns this instance if the erased version of this type is a class or interface (as opposed to a primitive or array array) ornullif it is not.- Specified by:
isClassOrInterfacein interfaceJType
-
isEnum
public JEnumType isEnum()
Description copied from interface:JTypeReturns this instance if it is an enumeration ornullif it is not.
-
isGenericType
public JGenericType isGenericType()
Description copied from interface:JTypeReturns this instance if it is a real class that has type parameters ornullif it is not.- Specified by:
isGenericTypein interfaceJType
-
isInterface
public JClassType isInterface()
Description copied from interface:JTypeReturns this instance if it is an interface ornullif it is not.- Specified by:
isInterfacein interfaceJType
-
isParameterized
public JParameterizedType isParameterized()
Description copied from interface:JTypeReturns this instance as aJParameterizedTypeif it is a parameterized type ornullif it is not.- Specified by:
isParameterizedin interfaceJType
-
isPrimitive
public JPrimitiveType isPrimitive()
- Specified by:
isPrimitivein interfaceJType
-
isRawType
public JRawType isRawType()
Description copied from interface:JTypeReturns the raw type if this is aJRawType, otherwise returnsnull.
-
isTypeParameter
public JTypeParameter isTypeParameter()
- Specified by:
isTypeParameterin interfaceJType
-
isWildcard
public JWildcardType isWildcard()
- Specified by:
isWildcardin interfaceJType
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Enum<JPrimitiveType>
-
-