Interface ResolvedType
- All Known Implementing Classes:
ResolvedArrayType,ResolvedIntersectionType,ResolvedLambdaConstraintType,ResolvedPrimitiveType,ResolvedReferenceType,ResolvedTypeVariable,ResolvedUnionType,ResolvedVoidType,ResolvedWildcard
public interface ResolvedType
A resolved type.
-
It could be a primitive type or a reference type (enum, class, interface).
In the latter case, it could take type typeParametersValues (other
TypeUsages). -
It could also be a
TypeVariable, like in:class A<B> {}whereBis aTypeVariable. -
It could also be
WildcardType, possibly with constraints. -
It could also be a
TypeVariable, like in:class A<B> {}.
- Author:
- Federico Tomassetti
-
Method Summary
Modifier and TypeMethodDescriptiondefault intdefault ResolvedArrayTypedefault ResolvedLambdaConstraintTypedefault ResolvedPrimitiveTypedefault ResolvedReferenceTypedefault ResolvedTypeParameterDeclarationdefault ResolvedTypeVariabledefault ResolvedUnionTypedefault ResolvedWildcarddescribe()default ResolvedTypeerasure()default booleanisArray()booleanisAssignableBy(ResolvedType other)This method checks if ThisType t = new OtherType() would compile.default booleanIs this a lambda constraint type?default booleandefault booleanisNull()Is this the null type?default booleandefault booleanIs this a primitive type?default booleanIs this a non primitive value?default booleanCan this be seen as a ReferenceTypeUsage? In other words: is this a reference to a class, an interface or an enum?default booleandefault booleanIs this a union type (as the ones used in multi catch clauses)?default booleanisVoid()default booleandefault booleanmention(List<ResolvedTypeParameterDeclaration> typeParameters)Does this type mention at all, directly or indirectly, the given type parameters?default ResolvedTypereplaceTypeVariables(ResolvedTypeParameterDeclaration tp, ResolvedType replaced)This is like (replaceTypeVariables(ResolvedTypeParameterDeclaration, ResolvedType, Map)but ignores the inferred values.default ResolvedTypereplaceTypeVariables(ResolvedTypeParameterDeclaration tp, ResolvedType replaced, Map<ResolvedTypeParameterDeclaration,ResolvedType> inferredTypes)Replace all variables referring to the given TypeParameter with the given value.
-
Method Details
-
isArray
default boolean isArray()- Returns:
- true, if this type represent an array - otherwise false.
-
arrayLevel
default int arrayLevel()- Returns:
- The level of nesting that this type is present at. For example, int[][] would have an array level of 2, and int would have an array level of 0 (not an array).
-
isPrimitive
default boolean isPrimitive()Is this a primitive type? -
isNull
default boolean isNull()Is this the null type? -
isUnionType
default boolean isUnionType()Is this a union type (as the ones used in multi catch clauses)? -
isReference
default boolean isReference()Is this a non primitive value? -
isConstraint
default boolean isConstraint()Is this a lambda constraint type? -
isReferenceType
default boolean isReferenceType()Can this be seen as a ReferenceTypeUsage? In other words: is this a reference to a class, an interface or an enum? -
isVoid
default boolean isVoid() -
isTypeVariable
default boolean isTypeVariable() -
isWildcard
default boolean isWildcard() -
isInferenceVariable
default boolean isInferenceVariable() -
asArrayType
-
asReferenceType
-
asTypeParameter
-
asTypeVariable
-
asPrimitive
-
asWildcard
-
asConstraintType
-
asUnionType
-
describe
String describe() -
replaceTypeVariables
default ResolvedType replaceTypeVariables(ResolvedTypeParameterDeclaration tp, ResolvedType replaced, Map<ResolvedTypeParameterDeclaration,ResolvedType> inferredTypes)Replace all variables referring to the given TypeParameter with the given value. By replacing these values I could also infer some type equivalence. Those would be collected in the given map. -
replaceTypeVariables
default ResolvedType replaceTypeVariables(ResolvedTypeParameterDeclaration tp, ResolvedType replaced)This is like (replaceTypeVariables(ResolvedTypeParameterDeclaration, ResolvedType, Map)but ignores the inferred values. -
mention
Does this type mention at all, directly or indirectly, the given type parameters? -
isAssignableBy
This method checks if ThisType t = new OtherType() would compile. -
isNumericType
default boolean isNumericType() -
erasure
-