public class PrimitiveType_c extends Type_c implements PrimitiveType
PrimitiveType
represents a type which may not be directly
coerced to java.lang.Object (under the standard Java type system).
This class should never be instantiated directly. Instead, you should
use the TypeSystem.get*
methods.
PrimitiveType.Kind
Modifier and Type | Field and Description |
---|---|
protected PrimitiveType.Kind |
kind |
position, ts
Modifier | Constructor and Description |
---|---|
protected |
PrimitiveType_c()
Used for deserializing types.
|
|
PrimitiveType_c(TypeSystem ts,
PrimitiveType.Kind kind) |
Modifier and Type | Method and Description |
---|---|
boolean |
descendsFromImpl(Type ancestor)
Return true if this type descends from
ancestor . |
boolean |
equalsImpl(TypeObject t)
Default implementation is pointer equality.
|
java.lang.String |
fullName()
Full dotted-name of the type object.
|
int |
hashCode() |
boolean |
isBoolean()
Return true if boolean.
|
boolean |
isByte()
Return true if byte.
|
boolean |
isCanonical()
Return true if the type object contains no unknown/ambiguous types.
|
boolean |
isCastValidImpl(Type toType)
Requires: all type arguments are canonical.
|
boolean |
isChar()
Return true if char.
|
boolean |
isDouble()
Return true if double.
|
boolean |
isFloat()
Return true if float.
|
boolean |
isImplicitCastValidImpl(Type toType)
Return true if a value of this type can be assigned to a variable of
type
toType . |
boolean |
isInt()
Return true if int.
|
boolean |
isIntOrLess()
Return true if int, short, byte, or char.
|
boolean |
isLong()
Return true if long.
|
boolean |
isLongOrLess()
Return true if long, int, short, byte, or char.
|
boolean |
isNumeric()
Return true if double, float, long, int, short, byte, or char.
|
boolean |
isPrimitive()
Return true if a primitive type.
|
boolean |
isShort()
Return true if short.
|
boolean |
isVoid()
Return true if void.
|
PrimitiveType.Kind |
kind()
The kind of primitive.
|
java.lang.String |
name()
Simple name of the type object.
|
boolean |
numericConversionValidImpl(java.lang.Object value)
Return true a literal
value can be converted to this type. |
PrimitiveType |
toPrimitive()
Cast the type to a primitive type, or null.
|
java.lang.String |
toString()
Yields a string representing this type.
|
java.lang.String |
translate(Resolver c)
Return a string into which to translate the type.
|
boolean |
typeEqualsImpl(Type t)
Return true if this type is equivalent to t.
|
java.lang.String |
wrapperTypeString(TypeSystem ts)
A string representing the type used to box this primitive.
|
arrayOf, arrayOf, descendsFrom, isArray, isCastValid, isClass, isComparable, isImplicitCastValid, isNull, isPackage, isReference, isSubtype, isSubtypeImpl, isThrowable, isType, isUncheckedException, numericConversionValid, numericConversionValid, numericConversionValidImpl, print, toArray, toClass, toNull, toPackage, toReference, toType, typeEquals
copy, equals, position, typeSystem
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
arrayOf, arrayOf, descendsFrom, isArray, isCastValid, isClass, isComparable, isImplicitCastValid, isNull, isReference, isSubtype, isSubtypeImpl, isThrowable, isUncheckedException, numericConversionValid, numericConversionValid, numericConversionValidImpl, print, toArray, toClass, toNull, toReference, typeEquals
position, typeSystem
protected PrimitiveType.Kind kind
protected PrimitiveType_c()
public PrimitiveType_c(TypeSystem ts, PrimitiveType.Kind kind)
public PrimitiveType.Kind kind()
PrimitiveType
kind
in interface PrimitiveType
public java.lang.String toString()
Type
public java.lang.String translate(Resolver c)
Type
public boolean isCanonical()
TypeObject
isCanonical
in interface TypeObject
isCanonical
in class Type_c
public boolean isPrimitive()
Type
isPrimitive
in interface Type
isPrimitive
in class Type_c
public PrimitiveType toPrimitive()
Type
toPrimitive
in interface Type
toPrimitive
in class Type_c
isPrimitive()
returns true.public boolean isVoid()
Type
public boolean isBoolean()
Type
public boolean isChar()
Type
public boolean isByte()
Type
public boolean isShort()
Type
public boolean isInt()
Type
public boolean isLong()
Type
public boolean isFloat()
Type
public boolean isDouble()
Type
public boolean isIntOrLess()
Type
isIntOrLess
in interface Type
isIntOrLess
in class Type_c
public boolean isLongOrLess()
Type
isLongOrLess
in interface Type
isLongOrLess
in class Type_c
public boolean isNumeric()
Type
public int hashCode()
hashCode
in class TypeObject_c
public boolean equalsImpl(TypeObject t)
TypeObject_c
equalsImpl
in interface TypeObject
equalsImpl
in class TypeObject_c
TypeObject_c.equalsImpl(TypeObject)
,
Object.hashCode()
public boolean typeEqualsImpl(Type t)
Type
typeEqualsImpl
in interface Type
typeEqualsImpl
in class Type_c
t
- Type to compare topublic java.lang.String wrapperTypeString(TypeSystem ts)
PrimitiveType
wrapperTypeString
in interface PrimitiveType
public java.lang.String name()
Named
public java.lang.String fullName()
Named
public boolean descendsFromImpl(Type ancestor)
Type
ancestor
.descendsFromImpl
in interface Type
descendsFromImpl
in class Type_c
public boolean isImplicitCastValidImpl(Type toType)
Type
toType
.isImplicitCastValidImpl
in interface Type
isImplicitCastValidImpl
in class Type_c
public boolean isCastValidImpl(Type toType)
isCastValidImpl
in interface Type
isCastValidImpl
in class Type_c
public boolean numericConversionValidImpl(java.lang.Object value)
Type
value
can be converted to this type.numericConversionValidImpl
in interface Type
numericConversionValidImpl
in class Type_c