Enum ResolvedPrimitiveType
- java.lang.Object
-
- java.lang.Enum<ResolvedPrimitiveType>
-
- com.github.javaparser.resolution.types.ResolvedPrimitiveType
-
- All Implemented Interfaces:
ResolvedType,java.io.Serializable,java.lang.Comparable<ResolvedPrimitiveType>
public enum ResolvedPrimitiveType extends java.lang.Enum<ResolvedPrimitiveType> implements ResolvedType
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ClassboxTypeClassprivate java.lang.Stringnameprivate java.util.List<ResolvedPrimitiveType>promotionTypes
-
Constructor Summary
Constructors Modifier Constructor Description privateResolvedPrimitiveType(java.lang.String name, java.lang.Class boxTypeClass, java.util.List<ResolvedPrimitiveType> promotionTypes)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ResolvedPrimitiveTypeasPrimitive()ResolvedPrimitiveTypebnp(ResolvedPrimitiveType other)static java.util.Optional<ResolvedType>byBoxTypeQName(java.lang.String qName)static ResolvedTypebyName(java.lang.String name)java.lang.Stringdescribe()java.lang.ClassgetBoxTypeClass()java.lang.StringgetBoxTypeQName()static ResolvedPrimitiveType[]getNumericPrimitiveTypes()booleanin(ResolvedPrimitiveType... types)booleanisArray()booleanisAssignableBy(ResolvedType other)This method checks if ThisType t = new OtherType() would compile.booleanisBoolean()Is this a boolean type?static booleanisBoxType(ResolvedType type)booleanisNumeric()booleanisPrimitive()Is this a primitive type?booleanisReferenceType()Can this be seen as a ReferenceTypeUsage? In other words: is this a reference to a class, an interface or an enum?booleanisTypeVariable()java.lang.StringtoDescriptor()java.lang.StringtoString()static ResolvedTypeunp(ResolvedType type)static ResolvedPrimitiveTypevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static ResolvedPrimitiveType[]values()Returns an array containing the constants of this enum type, in the order they are declared.-
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
-
Methods inherited from interface com.github.javaparser.resolution.types.ResolvedType
arrayLevel, asArrayType, asConstraintType, asReferenceType, asTypeParameter, asTypeVariable, asUnionType, asWildcard, erasure, isConstraint, isInferenceVariable, isNull, isNumericType, isReference, isUnionType, isVoid, isWildcard, mention, replaceTypeVariables, replaceTypeVariables, solveGenericTypes
-
-
-
-
Enum Constant Detail
-
BYTE
public static final ResolvedPrimitiveType BYTE
-
SHORT
public static final ResolvedPrimitiveType SHORT
-
CHAR
public static final ResolvedPrimitiveType CHAR
-
INT
public static final ResolvedPrimitiveType INT
-
LONG
public static final ResolvedPrimitiveType LONG
-
BOOLEAN
public static final ResolvedPrimitiveType BOOLEAN
-
FLOAT
public static final ResolvedPrimitiveType FLOAT
-
DOUBLE
public static final ResolvedPrimitiveType DOUBLE
-
-
Field Detail
-
name
private java.lang.String name
-
boxTypeClass
private java.lang.Class boxTypeClass
-
promotionTypes
private java.util.List<ResolvedPrimitiveType> promotionTypes
-
-
Constructor Detail
-
ResolvedPrimitiveType
private ResolvedPrimitiveType(java.lang.String name, java.lang.Class boxTypeClass, java.util.List<ResolvedPrimitiveType> promotionTypes)
-
-
Method Detail
-
values
public static ResolvedPrimitiveType[] 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 (ResolvedPrimitiveType c : ResolvedPrimitiveType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ResolvedPrimitiveType 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
-
byName
public static ResolvedType byName(java.lang.String name)
-
isBoxType
public static boolean isBoxType(ResolvedType type)
-
byBoxTypeQName
public static java.util.Optional<ResolvedType> byBoxTypeQName(java.lang.String qName)
-
getNumericPrimitiveTypes
public static ResolvedPrimitiveType[] getNumericPrimitiveTypes()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Enum<ResolvedPrimitiveType>
-
asPrimitive
public ResolvedPrimitiveType asPrimitive()
- Specified by:
asPrimitivein interfaceResolvedType
-
isArray
public boolean isArray()
- Specified by:
isArrayin interfaceResolvedType- Returns:
- true, if this type represent an array - otherwise false.
-
isPrimitive
public boolean isPrimitive()
Description copied from interface:ResolvedTypeIs this a primitive type?- Specified by:
isPrimitivein interfaceResolvedType
-
isReferenceType
public boolean isReferenceType()
Description copied from interface:ResolvedTypeCan this be seen as a ReferenceTypeUsage? In other words: is this a reference to a class, an interface or an enum?- Specified by:
isReferenceTypein interfaceResolvedType
-
describe
public java.lang.String describe()
- Specified by:
describein interfaceResolvedType
-
isTypeVariable
public boolean isTypeVariable()
- Specified by:
isTypeVariablein interfaceResolvedType
-
isAssignableBy
public boolean isAssignableBy(ResolvedType other)
Description copied from interface:ResolvedTypeThis method checks if ThisType t = new OtherType() would compile.- Specified by:
isAssignableByin interfaceResolvedType
-
getBoxTypeQName
public java.lang.String getBoxTypeQName()
-
getBoxTypeClass
public java.lang.Class getBoxTypeClass()
-
isNumeric
public boolean isNumeric()
-
isBoolean
public boolean isBoolean()
Is this a boolean type?
-
bnp
public ResolvedPrimitiveType bnp(ResolvedPrimitiveType other)
-
unp
public static ResolvedType unp(ResolvedType type)
-
in
public boolean in(ResolvedPrimitiveType... types)
-
toDescriptor
public java.lang.String toDescriptor()
- Specified by:
toDescriptorin interfaceResolvedType
-
-