public abstract class JavaType<T> extends Object
The hierarchy of types:
JavaType
PrimitiveType
ReferenceType
ClassType
ArrayType
TypeVar
IntersectionType
NullType
Example usage:
JavaType<String> typeString = ClassType.of(String.class);
Abstract Method | |
---|---|
String |
toString(boolean full)
A textual description of the type.
|
Instance Methods | |
int |
hashCode() |
boolean |
equals(Object obj)
Whether this type is equal to another type.
|
String |
toString()
A textual description of the type.
|
Static Method | |
<T> JavaType<T> |
convertFrom(Type jlrType)
Convert a
java.lang.reflect.Type to
bayou.jtype.JavaType |
public abstract String toString(boolean full)
If `full==false`, simpler names are used for types.
For example:
ClassType< List<String> > type = ClassType.of(List.class, String.class); type.toString(true); // "java.util.List<java.lang.String>" type.toString(false); // "List<String>"
public boolean equals(Object obj)
Equality is only tested syntactically. It is possible that type A,B are equivalent, e.g. `A<:B and B<:A`, yet `A.equals(B)==false`.
To check equivalency through mutual subtyping,
use TypeMath.isSubType
.
public String toString()
This method is equivalent to toString(true)
.
public static <T> JavaType<T> convertFrom(Type jlrType)
java.lang.reflect.Type
to
bayou.jtype.JavaType
This method does not accept java.lang.reflect.WildcardType
,
because a wildcard is not a type.