@NonNullByDefault public class CompoundTypeReference extends LightweightTypeReference
LightweightTypeReference.IdentifierFunction, LightweightTypeReference.JavaIdentifierFunction, LightweightTypeReference.SimpleNameFunction, LightweightTypeReference.UniqueIdentifierFunction
KIND_ANY_TYPE_REFERENCE, KIND_ARRAY_TYPE_REFERENCE, KIND_COMPOUND_TYPE_REFERENCE, KIND_FUNCTION_TYPE_REFERENCE, KIND_LIGHTWEIGHT_TYPE_REFERENCE, KIND_PARAMETERIZED_TYPE_REFERENCE, KIND_UNBOUND_TYPE_REFERENCE, KIND_UNKNOWN_TYPE_REFERENCE, KIND_WILDCARD_TYPE_REFERENCE
Constructor and Description |
---|
CompoundTypeReference(ITypeReferenceOwner owner,
boolean synonym) |
Modifier and Type | Method and Description |
---|---|
void |
accept(TypeReferenceVisitor visitor) |
<Param> void |
accept(TypeReferenceVisitorWithParameter<Param> visitor,
Param param) |
<Param,Result> |
accept(TypeReferenceVisitorWithParameterAndResult<Param,Result> visitor,
Param param) |
<Result> Result |
accept(TypeReferenceVisitorWithResult<Result> visitor) |
void |
addComponent(LightweightTypeReference component) |
protected LightweightTypeReference |
doCopyInto(ITypeReferenceOwner owner) |
java.lang.String |
getIdentifier() |
java.lang.String |
getJavaIdentifier() |
int |
getKind()
Subclasses must override this method.
|
java.util.List<LightweightTypeReference> |
getMultiTypeComponents() |
LightweightTypeReference |
getRawTypeReference() |
java.lang.String |
getSimpleName() |
LightweightTypeReference |
getSuperType(java.lang.Class<?> rawType)
Returns the resolved super type for the given raw type or
null if the raw type
is not a valid super type of this type. |
LightweightTypeReference |
getSuperType(JvmType rawType)
Returns the resolved super type for the given raw type or null if the raw type
is not a valid super type of this type.
|
protected java.util.List<LightweightTypeReference> |
getSuperTypes(TypeParameterSubstitutor<?> substitutor) |
JvmType |
getType() |
java.util.List<LightweightTypeReference> |
getTypeArguments()
Returns the type arguments of this reference if it has any.
|
java.lang.String |
getUniqueIdentifier()
Returns an identifier that allows to disambiguate type parameter names that have
different origins.
|
boolean |
isMultiType() |
boolean |
isOwnedBy(ITypeReferenceOwner owner) |
boolean |
isRawType()
Returns
true is this type points to a raw type. |
boolean |
isResolved() |
boolean |
isSynonym() |
boolean |
isType(java.lang.Class<?> clazz)
Returns true if this type reference represents an type with the given
raw type
clazz . |
boolean |
isVisible(IVisibilityHelper visibilityHelper)
Returns
true if this type is fully visible according to the given visibilityHelper . |
JvmTypeReference |
toJavaCompliantTypeReference(IVisibilityHelper visibilityHelper)
Converts this type reference to a
JvmTypeReference that can
be used in Java source code. |
LightweightTypeReference |
toJavaType()
Converts types to references that can be expressed as Java type references
in source code.
|
CompoundTypeReference |
toMultiType(LightweightTypeReference reference) |
JvmTypeReference |
toTypeReference() |
accept, accept, collectSuperTypes, collectSuperTypes, copyInto, createSubstitutor, expose, findNonNullType, findType, getAllSuperTypes, getAsFunctionTypeReference, getComponentType, getFunctionTypeKind, getInvariantBoundSubstitute, getLowerBoundSubstitute, getNonInterfaceTypes, getOwner, getPrimitiveIfWrapperType, getPrimitiveKind, getPrimitiveKindIfWrapperType, getRawTypes, getServices, getSuperTypes, getTypesFactory, getUniqueIdentifier, getUpperBoundSubstitute, getWrapperTypeIfPrimitive, internalFindTopLevelType, internalIsAssignableFrom, isAny, isArray, isAssignableFrom, isAssignableFrom, isAssignableFrom, isAssignableFrom, isFunctionType, isInterfaceType, isPrimitive, isPrimitiveVoid, isSubtypeOf, isSubtypeOf, isUnknown, isValidHint, isWildcard, isWrapper, toJavaCompliantTypeReference, toJavaCompliantTypeReference, toString, tryConvertToArray, tryConvertToFunctionTypeReference, tryConvertToListType
public CompoundTypeReference(ITypeReferenceOwner owner, boolean synonym)
public int getKind()
getKind
in class LightweightTypeReference
public JvmTypeReference toTypeReference()
toTypeReference
in class LightweightTypeReference
public boolean isVisible(IVisibilityHelper visibilityHelper)
LightweightTypeReference
true
if this type is fully visible according to the given visibilityHelper
.
All components and bounds are taken into account, e.g.
arrays
use their component type
and generified types
check their type arguments, too.isVisible
in class LightweightTypeReference
public JvmTypeReference toJavaCompliantTypeReference(IVisibilityHelper visibilityHelper)
JvmTypeReference
that can
be used in Java source code.
If this is a multi-type rather than a synonym
, the Java compliant
type reference is determined from the common super type of all participating, non-interface types.
If there is no such type or this is a synonym, all the component types are used to compute
the common super type and use that one as the type.toJavaCompliantTypeReference
in class LightweightTypeReference
public java.util.List<LightweightTypeReference> getTypeArguments()
LightweightTypeReference
List<String>
is String
.
? extends List<String>
.
Raw types don't carry type arguments. Wildcards with more than one upper bound
don't carry type arguments.getTypeArguments
in class LightweightTypeReference
public boolean isRawType()
LightweightTypeReference
true
is this type points to a raw type.
That is, it points to a parameterized type but does not define type arguments or
it points to an external type parameter that has a raw type constraint.
Type parameters that are declared by the current owner are not considered to be raw types.
A type is also a raw type if it inherits from a raw type.isRawType
in class LightweightTypeReference
public LightweightTypeReference getRawTypeReference()
getRawTypeReference
in class LightweightTypeReference
public boolean isOwnedBy(ITypeReferenceOwner owner)
isOwnedBy
in class LightweightTypeReference
@Nullable public JvmType getType()
getType
in class LightweightTypeReference
protected java.util.List<LightweightTypeReference> getSuperTypes(TypeParameterSubstitutor<?> substitutor)
getSuperTypes
in class LightweightTypeReference
@Nullable public LightweightTypeReference getSuperType(JvmType rawType)
LightweightTypeReference
getSuperType
in class LightweightTypeReference
rawType
- the raw type that should be resolved.@Nullable public LightweightTypeReference getSuperType(java.lang.Class<?> rawType)
LightweightTypeReference
null
if the raw type
is not a valid super type of this type.getSuperType
in class LightweightTypeReference
rawType
- the raw type that should be resolved.public boolean isType(java.lang.Class<?> clazz)
LightweightTypeReference
clazz
.
Returns false if this is not exactly the given type, but a sub type, a
super type or a completely unrelated type.isType
in class LightweightTypeReference
protected LightweightTypeReference doCopyInto(ITypeReferenceOwner owner)
doCopyInto
in class LightweightTypeReference
public boolean isResolved()
isResolved
in class LightweightTypeReference
public boolean isSynonym()
isSynonym
in class LightweightTypeReference
public void addComponent(LightweightTypeReference component)
public java.lang.String getSimpleName()
getSimpleName
in class LightweightTypeReference
public java.lang.String getIdentifier()
getIdentifier
in class LightweightTypeReference
public java.lang.String getUniqueIdentifier()
LightweightTypeReference
getUniqueIdentifier
in class LightweightTypeReference
public java.lang.String getJavaIdentifier()
getJavaIdentifier
in class LightweightTypeReference
public void accept(TypeReferenceVisitor visitor)
accept
in class LightweightTypeReference
public <Param> void accept(TypeReferenceVisitorWithParameter<Param> visitor, Param param)
accept
in class LightweightTypeReference
@Nullable public <Result> Result accept(TypeReferenceVisitorWithResult<Result> visitor)
accept
in class LightweightTypeReference
@Nullable public <Param,Result> Result accept(TypeReferenceVisitorWithParameterAndResult<Param,Result> visitor, Param param)
accept
in class LightweightTypeReference
public CompoundTypeReference toMultiType(LightweightTypeReference reference)
toMultiType
in class LightweightTypeReference
public boolean isMultiType()
isMultiType
in class LightweightTypeReference
public LightweightTypeReference toJavaType()
LightweightTypeReference
toJavaType
in class LightweightTypeReference
public java.util.List<LightweightTypeReference> getMultiTypeComponents()
getMultiTypeComponents
in class LightweightTypeReference