|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.tools.javac.code.Type
public class Type
This class represents Java types. The class itself defines the behavior of the following types:
base types (tags: BYTE, CHAR, SHORT, INT, LONG, FLOAT, DOUBLE, BOOLEAN), type `void' (tag: VOID), the bottom type (tag: BOT), the missing type (tag: NONE).
The behavior of the following types is defined in subclasses, which are all static inner classes of this class:
class types (tag: CLASS, class: ClassType), array types (tag: ARRAY, class: ArrayType), method types (tag: METHOD, class: MethodType), package types (tag: PACKAGE, class: PackageType), type variables (tag: TYPEVAR, class: TypeVar), type arguments (tag: WILDCARD, class: WildcardType), polymorphic types (tag: FORALL, class: ForAll), the error type (tag: ERROR, class: ErrorType).
This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
TypeTags
Nested Class Summary | |
---|---|
static class |
Type.ArrayType
|
(package private) static class |
Type.BottomType
|
static class |
Type.CapturedType
A captured type variable comes from wildcards which can have both upper and lower bound. |
static class |
Type.ClassType
|
static class |
Type.DelegatedType
|
static class |
Type.ErasedClassType
|
static class |
Type.ErrorType
|
static class |
Type.ForAll
|
(package private) static class |
Type.JCNoType
Represents VOID or NONE. |
static class |
Type.Mapping
An abstract class for mappings from types to types |
static class |
Type.MethodType
|
static class |
Type.PackageType
|
static class |
Type.TypeVar
|
static class |
Type.UndetVar
A class for instantiatable variables, for use during type inference. |
static interface |
Type.Visitor<R,S>
A visitor for types. |
static class |
Type.WildcardType
|
Field Summary | |
---|---|
static boolean |
moreInfo
If this switch is turned on, the names of type variables and anonymous classes are printed with hashcodes appended. |
static Type.JCNoType |
noType
Constant type: no type at all. |
int |
tag
The tag of this type. |
Symbol.TypeSymbol |
tsym
The defining class / interface / package / type variable |
Constructor Summary | |
---|---|
Type(int tag,
Symbol.TypeSymbol tsym)
Define a type given its tag and type symbol |
Method Summary | ||
---|---|---|
|
accept(Type.Visitor<R,S> v,
S s)
|
|
|
accept(TypeVisitor<R,P> v,
P p)
Applies a visitor to this type. |
|
List<Type> |
allparams()
Return all parameters of this type and all its outer types in order outer (first) to inner (last). |
|
java.lang.String |
argtypes(boolean varargs)
|
|
Symbol.TypeSymbol |
asElement()
|
|
Type.MethodType |
asMethodType()
The underlying method type of this type. |
|
Type |
baseType()
If this is a constant type, return its underlying type. |
|
static List<Type> |
baseTypes(List<Type> ts)
Return the base types of a list of types. |
|
java.lang.Object |
clone()
|
|
void |
complete()
Complete loading all classes in this type. |
|
Type |
constType(java.lang.Object constValue)
Define a constant type, of the same kind as this type and with given constant value |
|
java.lang.Object |
constValue()
The constant value of this type, null if this type does not have a constant value attribute. |
|
static boolean |
contains(List<Type> ts,
Type t)
|
|
boolean |
contains(Type t)
Does this type contain occurrences of type t? |
|
boolean |
containsSome(List<Type> ts)
Does this type contain an occurrence of some type in `elems'? |
|
boolean |
equals(java.lang.Object t)
This method is analogous to isSameType, but weaker, since we never complete classes. |
|
Type |
getEnclosingType()
|
|
TypeKind |
getKind()
Returns the kind of this type. |
|
Type |
getLowerBound()
|
|
List<Type> |
getParameterTypes()
|
|
Type |
getReturnType()
|
|
List<Type> |
getThrownTypes()
|
|
List<Type> |
getTypeArguments()
Access methods. |
|
Type |
getUpperBound()
|
|
int |
hashCode()
Obeys the general contract of Object.hashCode . |
|
boolean |
isCompound()
|
|
boolean |
isErroneous()
Does this type contain "error" elements? |
|
static boolean |
isErroneous(List<Type> ts)
|
|
boolean |
isExtendsBound()
|
|
boolean |
isFalse()
Is this a constant type whose value is false? |
|
boolean |
isInterface()
|
|
boolean |
isParameterized()
Is this type parameterized? A class type is parameterized if it has some parameters. |
|
boolean |
isPrimitive()
|
|
boolean |
isRaw()
Is this type a raw type? A class type is a raw type if it misses some of its parameters. |
|
boolean |
isSuperBound()
|
|
boolean |
isTrue()
Is this a constant type whose value is true? |
|
boolean |
isUnbound()
|
|
static List<Type> |
map(List<Type> ts,
Type.Mapping f)
map a type function over a list of types |
|
Type |
map(Type.Mapping f)
map a type function over all immediate descendants of this type |
|
void |
setThrown(List<Type> ts)
|
|
java.lang.String |
stringValue()
The constant value of this type, converted to String |
|
java.lang.String |
toString()
The Java source which this type represents. |
|
static java.lang.String |
toString(List<Type> ts)
The Java source which this type list represents. |
|
Type |
withTypeVar(Type t)
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Type.JCNoType noType
public static boolean moreInfo
public int tag
TypeTags
public Symbol.TypeSymbol tsym
Constructor Detail |
---|
public Type(int tag, Symbol.TypeSymbol tsym)
Method Detail |
---|
public java.lang.Object constValue()
public <R,S> R accept(Type.Visitor<R,S> v, S s)
public Type map(Type.Mapping f)
public static List<Type> map(List<Type> ts, Type.Mapping f)
public Type constType(java.lang.Object constValue)
public Type baseType()
public static List<Type> baseTypes(List<Type> ts)
public java.lang.String toString()
toString
in interface TypeMirror
toString
in class java.lang.Object
public static java.lang.String toString(List<Type> ts)
public java.lang.String stringValue()
public boolean equals(java.lang.Object t)
equals
in interface TypeMirror
equals
in class java.lang.Object
t
- the object to be compared with this type
true
if the specified object is equal to this onepublic int hashCode()
TypeMirror
Object.hashCode
.
hashCode
in interface TypeMirror
hashCode
in class java.lang.Object
TypeMirror.equals(java.lang.Object)
public boolean isFalse()
public boolean isTrue()
public java.lang.String argtypes(boolean varargs)
public List<Type> getTypeArguments()
public Type getEnclosingType()
public List<Type> getParameterTypes()
public Type getReturnType()
public List<Type> getThrownTypes()
public Type getUpperBound()
public Type getLowerBound()
public void setThrown(List<Type> ts)
public List<Type> allparams()
public boolean isErroneous()
public static boolean isErroneous(List<Type> ts)
public boolean isParameterized()
public boolean isRaw()
public boolean isCompound()
public boolean isInterface()
public boolean isPrimitive()
public boolean contains(Type t)
public static boolean contains(List<Type> ts, Type t)
public boolean containsSome(List<Type> ts)
public boolean isSuperBound()
public boolean isExtendsBound()
public boolean isUnbound()
public Type withTypeVar(Type t)
public Type.MethodType asMethodType()
public void complete()
public java.lang.Object clone()
clone
in class java.lang.Object
public Symbol.TypeSymbol asElement()
public TypeKind getKind()
TypeMirror
kind
of this type.
getKind
in interface TypeMirror
public <R,P> R accept(TypeVisitor<R,P> v, P p)
TypeMirror
accept
in interface TypeMirror
R
- the return type of the visitor's methodsP
- the type of the additional parameter to the visitor's methodsv
- the visitor operating on this typep
- additional parameter to the visitor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |