public interface Type extends Qualifier
Type
is the base type of all classes which represent
types.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 |
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 |
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 |
isUncheckedException()
Return true if an unchecked exception.
|
boolean |
isVoid()
Return true if void.
|
boolean |
numericConversionValid(long value)
Deprecated.
Use
numericConversionValid(Object) instead. |
boolean |
numericConversionValid(java.lang.Object value)
Return true a literal
value can be converted to this type. |
boolean |
numericConversionValidImpl(long value)
Deprecated.
Use
numericConversionValidImpl(Object) instead. |
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.
|
PrimitiveType |
toPrimitive()
Cast the type to a primitive type, or null.
|
ReferenceType |
toReference()
Cast the type to a reference 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 |
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.
|
equalsImpl, isCanonical, position, typeSystem
java.lang.String translate(Resolver c)
c
- A resolver in which to lookup this type to determine if
the type is unique in the given resolver.ArrayType arrayOf()
ArrayType arrayOf(int dims)
dims
-array of this type.ClassType toClass()
isClass()
returns true.NullType toNull()
isNull()
returns true.ReferenceType toReference()
isReference()
returns true.PrimitiveType toPrimitive()
isPrimitive()
returns true.ArrayType toArray()
isArray()
returns true.boolean typeEquals(Type t)
t
- Type to compare toboolean typeEqualsImpl(Type t)
t
- Type to compare toboolean isSubtype(Type ancestor)
ancestor
.boolean descendsFrom(Type ancestor)
ancestor
.boolean isCastValid(Type toType)
toType
.boolean isImplicitCastValid(Type toType)
toType
.boolean numericConversionValid(java.lang.Object value)
value
can be converted to this type.@Deprecated boolean numericConversionValid(long value)
numericConversionValid(Object)
instead.value
can be converted to this type.boolean isSubtypeImpl(Type ancestor)
ancestor
.boolean descendsFromImpl(Type ancestor)
ancestor
.boolean isCastValidImpl(Type toType)
toType
.boolean isImplicitCastValidImpl(Type toType)
toType
.boolean numericConversionValidImpl(java.lang.Object value)
value
can be converted to this type.@Deprecated boolean numericConversionValidImpl(long value)
numericConversionValidImpl(Object)
instead.value
can be converted to this type.boolean isPrimitive()
boolean isVoid()
boolean isBoolean()
boolean isChar()
boolean isByte()
boolean isShort()
boolean isInt()
boolean isLong()
boolean isFloat()
boolean isDouble()
boolean isIntOrLess()
boolean isLongOrLess()
boolean isNumeric()
boolean isReference()
boolean isNull()
boolean isArray()
boolean isClass()
boolean isThrowable()
Throwable
.boolean isUncheckedException()
boolean isComparable(Type t)
java.lang.String toString()
toString
in class java.lang.Object
void print(CodeWriter w)
w
.
For generated output, this method should be used
rather than toString(). It is suggested, but not
required, that it be an easily human-readable
representation that can be used both in error
messages and in generated output.