Top Methods
org.eclipse.xtend.lib.macro.declaration

public Interface TypeReference

extends Element
Annotations
@Beta
Imports
java.util.List, com.google.common.annotations.Beta

Author
Sven Efftinge

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

whether the given obj is the same instance
equals
(Object obj)

Checks whether this type reference equals the given type reference.

public List<TypeReference>

Returns:

the type arguments
getActualTypeArguments
()

public Iterable<? extends ResolvedMethod>

Returns:

the resolved methods declared in this type and its supertypes.
getAllResolvedMethods
()

Computes all the resolved methods that can be called on this type, either because they were declared directly by the type or by one of its supertypes.

public TypeReference

Returns:

the component type if this tye reference is an array type reference, null otherwise.
getArrayComponentType
()

public Iterable<? extends ResolvedConstructor>

Returns:

the resolved constructors directly declared by this type
getDeclaredResolvedConstructors
()

public Iterable<? extends ResolvedMethod>

Returns:

the resolved methods directly declared by this type
getDeclaredResolvedMethods
()

public Iterable<? extends TypeReference>

Returns:

the supertypes (superclass and interfaces) directly implemented/extended by this type
getDeclaredSuperTypes
()

public TypeReference

Returns:

the lower bounds
getLowerBound
()

public String

Returns:

the qualified name of this type reference
getName
()

returns the text representation using the qualified names of the involved types.

public TypeReference

Returns:

the corresponding primitive TypeReference if this type references is a wrapper type. Returns this otherwise.
getPrimitiveIfWrapper
()

public String

Returns:

the simple name of this type reference
getSimpleName
()

Returns a text representation using the simple names of the involved types.

public Type

Returns:

the referenced type.
getType
()

public TypeReference

Returns:

the upper bounds
getUpperBound
()

public TypeReference

Returns:

the corresponding wrapper TypeReference if this type references is a primitive type. Returns this otherwise.
getWrapperIfPrimitive
()

public int
hashCode()

Value-based for all TypeReferences where isInferred() is false.

public boolean

Returns:

whether this is the any type, The any type is the subtype of every reference type and its only instance is null.
isAnyType
()

public boolean

Returns:

whether this is an array
isArray
()

public boolean

Returns:

returns true is the specified type reference parameter can be assigned to this type reference.
isAssignableFrom
(TypeReference typeReference)

Determines if the specified TypeReference parameter can be assigned to this TypeReference.

public boolean

Returns:

whether this type reference is an inferred type reference.
isInferred
()

Whether the given type reference is an inferred reference.

public boolean

Returns:

whether this is a primitive type (i.e. one of boolean, char, byte, short, int, long, float, double).
isPrimitive
()

public boolean

Returns:

whether this type is 'void' (doesn't include 'java.lang.Void')
isVoid
()

public boolean

Returns:

whether this is a wildcard reference
isWildCard
()

public boolean

Returns:

wither this is one of the wrapper types for the primitive value types.
isWrapper
()

Checks whether this type is one of the wrapper types for the primitive value types.

public String

Returns:

a string representation
toString
()

A string representation for this type reference.

Method Detail

equalsback to summary
public boolean equals(Object obj)

Checks whether this type reference equals the given type reference. For type References where isInferred() is true, the implementation is based on identity of the underlying AST.

Returns:boolean

whether the given obj is the same instance

Since
2.7
getActualTypeArgumentsback to summary
public List<TypeReference> getActualTypeArguments()
Returns:List<TypeReference>

the type arguments

getAllResolvedMethodsback to summary
public Iterable<? extends ResolvedMethod> getAllResolvedMethods()

Computes all the resolved methods that can be called on this type, either because they were declared directly by the type or by one of its supertypes. For overloaded methods, the one declared closest to this type is used. E.g. when called on the class C in this hierarchy:

class A {
 def CharSequence foo()
}
class B extends A {
 override String foo()
}
class C extends B {}

B#foo() would be contained, but not A#foo().
Returns:Iterable<? extends ResolvedMethod>

the resolved methods declared in this type and its supertypes.

Since
2.7
getArrayComponentTypeback to summary
public TypeReference getArrayComponentType()
Returns:TypeReference

the component type if this tye reference is an array type reference, null otherwise.

getDeclaredResolvedConstructorsback to summary
public Iterable<? extends ResolvedConstructor> getDeclaredResolvedConstructors()
Returns:Iterable<? extends ResolvedConstructor>

the resolved constructors directly declared by this type

Since
2.7
getDeclaredResolvedMethodsback to summary
public Iterable<? extends ResolvedMethod> getDeclaredResolvedMethods()
Returns:Iterable<? extends ResolvedMethod>

the resolved methods directly declared by this type

Since
2.7
getDeclaredSuperTypesback to summary
public Iterable<? extends TypeReference> getDeclaredSuperTypes()
Returns:Iterable<? extends TypeReference>

the supertypes (superclass and interfaces) directly implemented/extended by this type

Since
2.7
getLowerBoundback to summary
public TypeReference getLowerBound()
Returns:TypeReference

the lower bounds

getNameback to summary
public String getName()

returns the text representation using the qualified names of the involved types.

Returns:String

the qualified name of this type reference

getPrimitiveIfWrapperback to summary
public TypeReference getPrimitiveIfWrapper()
Returns:TypeReference

the corresponding primitive TypeReference if this type references is a wrapper type. Returns this otherwise.

getSimpleNameback to summary
public String getSimpleName()

Returns a text representation using the simple names of the involved types. I.e. for 'java.util.List<? extends java.math.BigDecimal>' this method returns 'List<? extends BigDecimal>'

Returns:String

the simple name of this type reference

getTypeback to summary
public Type getType()
Returns:Type

the referenced type.

getUpperBoundback to summary
public TypeReference getUpperBound()
Returns:TypeReference

the upper bounds

getWrapperIfPrimitiveback to summary
public TypeReference getWrapperIfPrimitive()
Returns:TypeReference

the corresponding wrapper TypeReference if this type references is a primitive type. Returns this otherwise.

hashCodeback to summary
public int hashCode()

Value-based for all TypeReferences where isInferred() is false.

Since
2.7
isAnyTypeback to summary
public boolean isAnyType()
Returns:boolean

whether this is the any type, The any type is the subtype of every reference type and its only instance is null.

isArrayback to summary
public boolean isArray()
Returns:boolean

whether this is an array

isAssignableFromback to summary
public boolean isAssignableFrom(TypeReference typeReference)

Determines if the specified TypeReference parameter can be assigned to this TypeReference. It returns true if so; otherwise it returns false.

Returns:boolean

returns true is the specified type reference parameter can be assigned to this type reference.

isInferredback to summary
public boolean isInferred()

Whether the given type reference is an inferred reference. That is the type is to be computed from some Expression, e.g. a method body or a field initializer. Inferred type references can only be used as handles, and will through an UnsupportedOperationException on every method other than

Returns:boolean

whether this type reference is an inferred type reference.

isPrimitiveback to summary
public boolean isPrimitive()
Returns:boolean

whether this is a primitive type (i.e. one of boolean, char, byte, short, int, long, float, double).

isVoidback to summary
public boolean isVoid()
Returns:boolean

whether this type is 'void' (doesn't include 'java.lang.Void')

isWildCardback to summary
public boolean isWildCard()
Returns:boolean

whether this is a wildcard reference

isWrapperback to summary
public boolean isWrapper()

Checks whether this type is one of the wrapper types for the primitive value types.

Returns:boolean

wither this is one of the wrapper types for the primitive value types.

toStringback to summary
public String toString()

A string representation for this type reference. If this reference is resolved, it will return the simple name of this reference. Otherwise a technical information about the inferred type reference.

Returns:String

a string representation

Annotations
@Override
Since
2.8