public abstract class Type_c extends TypeObject_c implements Type
Type. This implements most of
the "isa" and "cast" methods of the type and methods which just dispatch to
the type system.position, ts| Modifier | Constructor and Description |
|---|---|
protected |
Type_c()
Used for deserializing types.
|
|
Type_c(TypeSystem ts)
Creates a new type in the given a TypeSystem.
|
|
Type_c(TypeSystem ts,
Position pos)
Creates a new type in the given a TypeSystem at a given position.
|
| Modifier and Type | Method and Description |
|---|---|
ArrayType |
arrayOf()
Return an array of this type.
|
ArrayType |
arrayOf(int dims)
Return a
dims-array of this type. |
boolean |
descendsFrom(Type ancestor)
Return true if this type descends from
ancestor. |
boolean |
descendsFromImpl(Type ancestor)
Return true if this type descends from
ancestor. |
boolean |
isArray()
Return true if an array type.
|
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 |
isCastValid(Type toType)
Return true if this type can be cast to
toType. |
boolean |
isCastValidImpl(Type toType)
Return true if this type can be cast to
toType. |
boolean |
isChar()
Return true if char.
|
boolean |
isClass()
Return true if a class type.
|
boolean |
isComparable(Type t)
Return true if the types can be compared; that is, if they have
the same type system.
|
boolean |
isDouble()
Return true if double.
|
boolean |
isFloat()
Return true if float.
|
boolean |
isImplicitCastValid(Type toType)
Return true if a value of this type can be assigned to a variable of
type
toType. |
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 |
isNull()
Return true if a null type.
|
boolean |
isNumeric()
Return true if double, float, long, int, short, byte, or char.
|
boolean |
isPackage()
Return true if the qualifier is a package.
|
boolean |
isPrimitive()
Return true if a primitive type.
|
boolean |
isReference()
Return true if a reference type.
|
boolean |
isShort()
Return true if short.
|
boolean |
isSubtype(Type ancestor)
Return true if this type is a subtype of
ancestor. |
boolean |
isSubtypeImpl(Type ancestor)
Return true if this type is a subtype of
ancestor. |
boolean |
isThrowable()
Return true if a subclass of
Throwable. |
boolean |
isType()
Return true if the qualifier is a type.
|
boolean |
isUncheckedException()
Return true if an unchecked exception.
|
boolean |
isVoid()
Return true if void.
|
boolean |
numericConversionValid(long value)
Deprecated.
|
boolean |
numericConversionValid(java.lang.Object value)
Return true a literal
value can be converted to this type. |
boolean |
numericConversionValidImpl(long value)
Deprecated.
|
boolean |
numericConversionValidImpl(java.lang.Object value)
Return true a literal
value can be converted to this type. |
void |
print(CodeWriter w)
Output a compilable representation of this type to
w. |
ArrayType |
toArray()
Cast the type to an array type, or null.
|
ClassType |
toClass()
Cast the type to a class type, or null.
|
NullType |
toNull()
Cast the type to a null type, or null.
|
Package |
toPackage()
Cast the qualifier to a package, or return null.
|
PrimitiveType |
toPrimitive()
Cast the type to a primitive type, or null.
|
ReferenceType |
toReference()
Cast the type to a reference type, or null.
|
abstract java.lang.String |
toString()
Yields a string representing this type.
|
Type |
toType()
Cast the qualifier to a type, or return null.
|
abstract java.lang.String |
translate(Resolver c)
Return a string into which to translate the type.
|
boolean |
typeEquals(Type t)
Return true if this type is equivalent to t.
|
boolean |
typeEqualsImpl(Type t)
Return true if this type is equivalent to t.
|
copy, equals, equalsImpl, hashCode, position, typeSystemclone, finalize, getClass, notify, notifyAll, wait, wait, waitequalsImpl, position, typeSystemprotected Type_c()
public Type_c(TypeSystem ts)
public Type_c(TypeSystem ts, Position pos)
public abstract java.lang.String translate(Resolver c)
Typepublic boolean isType()
Qualifierpublic boolean isPackage()
Qualifierpublic Type toType()
Qualifierpublic Package toPackage()
Qualifierpublic boolean isCanonical()
TypeObjectisCanonical in interface TypeObjectpublic boolean isPrimitive()
TypeisPrimitive in interface Typepublic boolean isNumeric()
Typepublic boolean isIntOrLess()
TypeisIntOrLess in interface Typepublic boolean isLongOrLess()
TypeisLongOrLess in interface Typepublic boolean isVoid()
Typepublic boolean isBoolean()
Typepublic boolean isChar()
Typepublic boolean isByte()
Typepublic boolean isShort()
Typepublic boolean isInt()
Typepublic boolean isLong()
Typepublic boolean isFloat()
Typepublic boolean isDouble()
Typepublic boolean isReference()
TypeisReference in interface Typepublic boolean isNull()
Typepublic boolean isClass()
Typepublic boolean isArray()
Typepublic boolean isThrowable()
TypeThrowable.isThrowable in interface Typepublic boolean isUncheckedException()
TypeisUncheckedException in interface Typepublic ClassType toClass()
Typepublic NullType toNull()
Typepublic ReferenceType toReference()
TypetoReference in interface TypeisReference() returns true.public PrimitiveType toPrimitive()
TypetoPrimitive in interface TypeisPrimitive() returns true.public ArrayType toArray()
Typepublic ArrayType arrayOf(int dims)
Typedims-array of this type.public ArrayType arrayOf()
Typepublic final boolean typeEquals(Type t)
TypetypeEquals in interface Typet - Type to compare topublic boolean typeEqualsImpl(Type t)
TypetypeEqualsImpl in interface Typet - Type to compare topublic final boolean isSubtype(Type ancestor)
Typeancestor.public boolean isSubtypeImpl(Type ancestor)
Typeancestor.isSubtypeImpl in interface Typepublic final boolean descendsFrom(Type ancestor)
Typeancestor.descendsFrom in interface Typepublic boolean descendsFromImpl(Type ancestor)
Typeancestor.descendsFromImpl in interface Typepublic final boolean isCastValid(Type toType)
TypetoType.isCastValid in interface Typepublic boolean isCastValidImpl(Type toType)
TypetoType.isCastValidImpl in interface Typepublic final boolean isImplicitCastValid(Type toType)
TypetoType.isImplicitCastValid in interface Typepublic boolean isImplicitCastValidImpl(Type toType)
TypetoType.isImplicitCastValidImpl in interface Type@Deprecated public final boolean numericConversionValid(long value)
Typevalue can be converted to this type.numericConversionValid in interface Type@Deprecated public boolean numericConversionValidImpl(long value)
Typevalue can be converted to this type.numericConversionValidImpl in interface Typepublic final boolean numericConversionValid(java.lang.Object value)
Typevalue can be converted to this type.numericConversionValid in interface Typepublic boolean numericConversionValidImpl(java.lang.Object value)
Typevalue can be converted to this type.numericConversionValidImpl in interface Typepublic boolean isComparable(Type t)
TypeisComparable in interface Typepublic abstract java.lang.String toString()
Typepublic void print(CodeWriter w)
w.
This implementation generates whatever representation is produced
by toString(). To satisfy the specification of
Type.toString(), this implementation needs to be overridden
if toString does not produce a compilable representation.