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 later case it could take type typeParametersValues (other TypeUsages). It could also be a TypeVariable, like in:class A<Bgt; { }
where B is a TypeVariable. It could also be Wildcard Type, possibly with constraints.
- Author:
- Federico Tomassetti
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
arrayLevel()
default ResolvedArrayType
asArrayType()
default ResolvedLambdaConstraintType
asConstraintType()
default ResolvedPrimitiveType
asPrimitive()
default ResolvedReferenceType
asReferenceType()
default ResolvedTypeParameterDeclaration
asTypeParameter()
default ResolvedTypeVariable
asTypeVariable()
default ResolvedUnionType
asUnionType()
default ResolvedWildcard
asWildcard()
String
describe()
default boolean
isArray()
Does this type represent an array?boolean
isAssignableBy(ResolvedType other)
This method checks if ThisType t = new OtherType() would compile.default boolean
isConstraint()
Is this a lambda constraint type?default boolean
isNull()
Is this the null type?default boolean
isPrimitive()
Is this a primitive type?default boolean
isReference()
Is this a non primitive value?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?default boolean
isTypeVariable()
default boolean
isUnionType()
Is this a union type (as the ones used in multi catch clauses)?default boolean
isVoid()
default boolean
isWildcard()
default boolean
mention(List<ResolvedTypeParameterDeclaration> typeParameters)
Does this type mention at all, directly or indirectly, the given type parameters?default ResolvedType
replaceTypeVariables(ResolvedTypeParameterDeclaration tp, ResolvedType replaced)
This is like (replaceTypeVariables(ResolvedTypeParameterDeclaration, ResolvedType, Map)
but ignores the inferred values.default ResolvedType
replaceTypeVariables(ResolvedTypeParameterDeclaration tp, ResolvedType replaced, Map<ResolvedTypeParameterDeclaration,ResolvedType> inferredTypes)
Replace all variables referring to the given TypeParameter with the given value.
-
-
-
Method Detail
-
isArray
default boolean isArray()
Does this type represent an array?
-
arrayLevel
default int arrayLevel()
-
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()
-
asArrayType
default ResolvedArrayType asArrayType()
-
asReferenceType
default ResolvedReferenceType asReferenceType()
-
asTypeParameter
default ResolvedTypeParameterDeclaration asTypeParameter()
-
asTypeVariable
default ResolvedTypeVariable asTypeVariable()
-
asPrimitive
default ResolvedPrimitiveType asPrimitive()
-
asWildcard
default ResolvedWildcard asWildcard()
-
asConstraintType
default ResolvedLambdaConstraintType asConstraintType()
-
asUnionType
default ResolvedUnionType 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
default boolean mention(List<ResolvedTypeParameterDeclaration> typeParameters)
Does this type mention at all, directly or indirectly, the given type parameters?
-
isAssignableBy
boolean isAssignableBy(ResolvedType other)
This method checks if ThisType t = new OtherType() would compile.
-
-