public class ArrayTypeReference 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_INNER_FUNCTION_TYPE_REFERENCE, KIND_INNER_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 |
---|
ArrayTypeReference(ITypeReferenceOwner owner,
LightweightTypeReference component) |
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) |
protected LightweightTypeReference |
doCopyInto(ITypeReferenceOwner owner) |
LightweightTypeReference |
getComponentType()
Returns the component type of the current array type.
|
java.lang.String |
getIdentifier()
Returns the identifier of this type reference.
|
java.lang.String |
getJavaIdentifier() |
int |
getKind()
Subclasses must override this method.
|
LightweightTypeReference |
getNamedType()
Returns the named type if this is an anonymous type.
|
LightweightTypeReference |
getRawTypeReference() |
java.lang.String |
getSimpleName()
Prints the simple name of this type reference.
|
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) |
JvmArrayType |
getType() |
java.lang.String |
getUniqueIdentifier()
Returns an identifier that allows to disambiguate type parameter names that have
different origins.
|
boolean |
isAnonymous() |
boolean |
isArray() |
boolean |
isOwnedBy(ITypeReferenceOwner owner) |
boolean |
isRawType()
Returns
true is this type points to a raw type. |
boolean |
isResolved() |
boolean |
isType(java.lang.Class<?> clazz)
Returns true if this type reference represents an type with the given
raw type
clazz . |
boolean |
isUnknown() |
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. |
JvmTypeReference |
toTypeReference() |
ArrayTypeReference |
tryConvertToArray()
Returns the array representation of this reference if its represents a subtype of
Iterable
or already an array itself. |
LightweightTypeReference |
tryConvertToListType()
Returns the list representation of this reference if it represents an array or is
already a subtype of
List . |
collectSuperTypes, collectSuperTypes, copyInto, createSubstitutor, expose, findNonNullType, findType, getAllSuperTypes, getAsFunctionTypeReference, getFunctionTypeKind, getHumanReadableName, getInvariantBoundSubstitute, getLowerBoundSubstitute, getMultiTypeComponents, getNonInterfaceTypes, getOuter, getOwner, getPrimitiveIfWrapperType, getPrimitiveKind, getPrimitiveKindIfWrapperType, getRawTypes, getServices, getSuperTypes, getTypeArguments, getTypesFactory, getUniqueIdentifier, getUpperBoundSubstitute, getWrapperTypeIfPrimitive, hasTypeArguments, internalFindTopLevelType, internalIsAssignableFrom, isAny, isAssignableFrom, isAssignableFrom, isAssignableFrom, isAssignableFrom, isFunctionType, isInterfaceType, isMultiType, isPrimitive, isPrimitiveVoid, isSubtypeOf, isSubtypeOf, isSynonym, isValidHint, isWildcard, isWrapper, toJavaCompliantTypeReference, toJavaCompliantTypeReference, toJavaType, toString, tryConvertToFunctionTypeReference
public ArrayTypeReference(ITypeReferenceOwner owner, LightweightTypeReference component)
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)
LightweightTypeReference
JvmTypeReference
that can
be used in Java source code.toJavaCompliantTypeReference
in class LightweightTypeReference
public JvmArrayType getType()
getType
in class LightweightTypeReference
public boolean isUnknown()
isUnknown
in class LightweightTypeReference
protected java.util.List<LightweightTypeReference> getSuperTypes(TypeParameterSubstitutor<?> substitutor)
getSuperTypes
in class LightweightTypeReference
public LightweightTypeReference getSuperType(JvmType rawType)
LightweightTypeReference
getSuperType
in class LightweightTypeReference
rawType
- the raw type that should be resolved.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 isResolved()
isResolved
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 boolean isAnonymous()
isAnonymous
in class LightweightTypeReference
public LightweightTypeReference getNamedType()
LightweightTypeReference
getNamedType
in class LightweightTypeReference
public LightweightTypeReference getRawTypeReference()
getRawTypeReference
in class LightweightTypeReference
public boolean isOwnedBy(ITypeReferenceOwner owner)
isOwnedBy
in class LightweightTypeReference
public boolean isArray()
isArray
in class LightweightTypeReference
public LightweightTypeReference tryConvertToListType()
LightweightTypeReference
List
.
If the array's type is a primitive, the list's element type is the wrapper.
May return null
if the conversion is not possible.tryConvertToListType
in class LightweightTypeReference
null
.public ArrayTypeReference tryConvertToArray()
LightweightTypeReference
Iterable
or already an array itself.
If the iterable's type is a primitive wrapper, the array is not the primitive array but
the wrapper array. May return null
if the conversion is not possible.tryConvertToArray
in class LightweightTypeReference
ArrayTypeReference
or null
.protected LightweightTypeReference doCopyInto(ITypeReferenceOwner owner)
doCopyInto
in class LightweightTypeReference
public java.lang.String getSimpleName()
LightweightTypeReference
getSimpleName
in class LightweightTypeReference
public java.lang.String getIdentifier()
LightweightTypeReference
getIdentifier
in class LightweightTypeReference
public java.lang.String getUniqueIdentifier()
LightweightTypeReference
getUniqueIdentifier
in class LightweightTypeReference
public java.lang.String getJavaIdentifier()
getJavaIdentifier
in class LightweightTypeReference
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
public LightweightTypeReference getComponentType()
LightweightTypeReference
getComponentType
in class LightweightTypeReference
null
.LightweightTypeReference.isArray()
public void accept(TypeReferenceVisitor visitor)
accept
in class LightweightTypeReference
public <Param> void accept(TypeReferenceVisitorWithParameter<Param> visitor, Param param)
accept
in class LightweightTypeReference
public <Result> Result accept(TypeReferenceVisitorWithResult<Result> visitor)
accept
in class LightweightTypeReference
public <Param,Result> Result accept(TypeReferenceVisitorWithParameterAndResult<Param,Result> visitor, Param param)
accept
in class LightweightTypeReference