public abstract class ReferenceType extends Object implements Type, TypeParametrized, TypeParameterValueProvider
| Modifier and Type | Field and Description |
|---|---|
protected TypeDeclaration |
typeDeclaration |
protected TypeParametersMap |
typeParametersMap |
protected TypeSolver |
typeSolver |
| Constructor and Description |
|---|
ReferenceType(TypeDeclaration typeDeclaration,
List<Type> typeParameters,
TypeSolver typeSolver) |
ReferenceType(TypeDeclaration typeDeclaration,
TypeSolver typeSolver) |
| Modifier and Type | Method and Description |
|---|---|
ReferenceType |
asReferenceType() |
protected boolean |
compareConsideringTypeParameters(ReferenceType other) |
protected abstract ReferenceType |
create(TypeDeclaration typeDeclaration,
List<Type> typeParameters,
TypeSolver typeSolver) |
protected ReferenceType |
create(TypeDeclaration typeDeclaration,
TypeParametersMap typeParametersMap,
TypeSolver typeSolver) |
protected abstract ReferenceType |
create(TypeDeclaration typeDeclaration,
TypeSolver typeSolver) |
ReferenceType |
deriveTypeParameters(TypeParametersMap typeParametersMap) |
String |
describe() |
boolean |
equals(Object o) |
List<ReferenceType> |
getAllAncestors()
Return all ancestors, that means all superclasses and interfaces.
|
List<ReferenceType> |
getAllInterfacesAncestors() |
abstract Set<MethodUsage> |
getDeclaredMethods()
Methods declared on this type.
|
Optional<Type> |
getFieldType(String name)
The type of the field could be different from the one in the corresponding FieldDeclaration because
type variables would be solved.
|
Optional<Type> |
getGenericParameterByName(String name)
Get the type associated with the type parameter with the given name.
|
String |
getId()
Id of the declaration.
|
String |
getQualifiedName()
Qualified name of the declaration.
|
TypeDeclaration |
getTypeDeclaration()
Corresponding TypeDeclaration
|
List<javaslang.Tuple2<TypeParameterDeclaration,Type>> |
getTypeParametersMap()
Get the values for all type parameters declared on this type.
|
int |
hashCode() |
boolean |
hasName()
Has the TypeDeclaration a name? Anonymous classes do not have one.
|
abstract boolean |
isAssignableBy(Type other)
This method checks if ThisType t = new OtherType() would compile.
|
protected boolean |
isCorrespondingBoxingType(String typeName) |
boolean |
isRawType() |
boolean |
isReferenceType()
Can this be seen as a ReferenceTypeUsage?
In other words: is this a reference to a class, an interface or an enum?
|
Type |
replaceTypeVariables(TypeParameterDeclaration tpToReplace,
Type replaced,
Map<TypeParameterDeclaration,Type> inferredTypes)
Replace all variables referring to the given TypeParameter with the given value.
|
String |
toString() |
Type |
transformTypeParameters(TypeTransformer transformer)
Execute a transformation on all the type parameters of this element.
|
TypeParametersMap |
typeParametersMap() |
List<Type> |
typeParametersValues()
Get the values for all type parameters declared on this type.
|
Optional<Type> |
typeParamValue(TypeParameterDeclaration typeParameterDeclaration)
Calculate the value for the given type parameter.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitarrayLevel, asArrayType, asPrimitive, asTypeParameter, asWildcard, isArray, isNull, isPrimitive, isReference, isTypeVariable, isVoid, isWildcard, replaceTypeVariablesuseThisTypeParametersOnTheGivenTypeprotected TypeDeclaration typeDeclaration
protected TypeSolver typeSolver
protected TypeParametersMap typeParametersMap
public ReferenceType(TypeDeclaration typeDeclaration, TypeSolver typeSolver)
public ReferenceType(TypeDeclaration typeDeclaration, List<Type> typeParameters, TypeSolver typeSolver)
public final boolean isReferenceType()
TypeisReferenceType in interface Typepublic ReferenceType asReferenceType()
asReferenceType in interface Typepublic Type transformTypeParameters(TypeTransformer transformer)
public Type replaceTypeVariables(TypeParameterDeclaration tpToReplace, Type replaced, Map<TypeParameterDeclaration,Type> inferredTypes)
TypereplaceTypeVariables in interface Typepublic abstract boolean isAssignableBy(Type other)
isAssignableBy in interface Typepublic List<ReferenceType> getAllAncestors()
For example, given:
class Foo<A, B> {} class Bar<C> extends Foo<C, String> {}
a call to getAllAncestors on a reference to Bar having type parameter Boolean should include Foo<Boolean, String>.
public List<ReferenceType> getAllInterfacesAncestors()
public Optional<Type> getGenericParameterByName(String name)
getGenericParameterByName in interface TypeParameterValueProviderpublic List<Type> typeParametersValues()
public List<javaslang.Tuple2<TypeParameterDeclaration,Type>> getTypeParametersMap()
public TypeParametersMap typeParametersMap()
typeParametersMap in interface TypeParametrizedpublic final TypeDeclaration getTypeDeclaration()
public Optional<Type> getFieldType(String name)
public boolean hasName()
public String getQualifiedName()
public String getId()
public abstract Set<MethodUsage> getDeclaredMethods()
public boolean isRawType()
public Optional<Type> typeParamValue(TypeParameterDeclaration typeParameterDeclaration)
TypeParameterValueProvidertypeParamValue in interface TypeParameterValueProviderprotected abstract ReferenceType create(TypeDeclaration typeDeclaration, List<Type> typeParameters, TypeSolver typeSolver)
protected ReferenceType create(TypeDeclaration typeDeclaration, TypeParametersMap typeParametersMap, TypeSolver typeSolver)
protected abstract ReferenceType create(TypeDeclaration typeDeclaration, TypeSolver typeSolver)
protected boolean isCorrespondingBoxingType(String typeName)
protected boolean compareConsideringTypeParameters(ReferenceType other)
public ReferenceType deriveTypeParameters(TypeParametersMap typeParametersMap)
Copyright © 2016. All rights reserved.