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.Class
boxTypeClass
private java.lang.String
name
private java.util.List<ResolvedPrimitiveType>
promotionTypes
-
Constructor Summary
Constructors Modifier Constructor Description private
ResolvedPrimitiveType(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 ResolvedPrimitiveType
asPrimitive()
ResolvedPrimitiveType
bnp(ResolvedPrimitiveType other)
static java.util.Optional<ResolvedType>
byBoxTypeQName(java.lang.String qName)
static ResolvedType
byName(java.lang.String name)
java.lang.String
describe()
java.lang.Class
getBoxTypeClass()
java.lang.String
getBoxTypeQName()
static ResolvedPrimitiveType[]
getNumericPrimitiveTypes()
boolean
in(ResolvedPrimitiveType... types)
boolean
isArray()
boolean
isAssignableBy(ResolvedType other)
This method checks if ThisType t = new OtherType() would compile.boolean
isBoolean()
Is this a boolean type?static boolean
isBoxType(ResolvedType type)
boolean
isNumeric()
boolean
isPrimitive()
Is this a primitive type?boolean
isReferenceType()
Can this be seen as a ReferenceTypeUsage? In other words: is this a reference to a class, an interface or an enum?boolean
isTypeVariable()
java.lang.String
toDescriptor()
java.lang.String
toString()
static ResolvedType
unp(ResolvedType type)
static ResolvedPrimitiveType
valueOf(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:
toString
in classjava.lang.Enum<ResolvedPrimitiveType>
-
asPrimitive
public ResolvedPrimitiveType asPrimitive()
- Specified by:
asPrimitive
in interfaceResolvedType
-
isArray
public boolean isArray()
- Specified by:
isArray
in interfaceResolvedType
- Returns:
- true, if this type represent an array - otherwise false.
-
isPrimitive
public boolean isPrimitive()
Description copied from interface:ResolvedType
Is this a primitive type?- Specified by:
isPrimitive
in interfaceResolvedType
-
isReferenceType
public boolean isReferenceType()
Description copied from interface:ResolvedType
Can this be seen as a ReferenceTypeUsage? In other words: is this a reference to a class, an interface or an enum?- Specified by:
isReferenceType
in interfaceResolvedType
-
describe
public java.lang.String describe()
- Specified by:
describe
in interfaceResolvedType
-
isTypeVariable
public boolean isTypeVariable()
- Specified by:
isTypeVariable
in interfaceResolvedType
-
isAssignableBy
public boolean isAssignableBy(ResolvedType other)
Description copied from interface:ResolvedType
This method checks if ThisType t = new OtherType() would compile.- Specified by:
isAssignableBy
in 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:
toDescriptor
in interfaceResolvedType
-
-