Class ArrayTypeReference
- java.lang.Object
-
- org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference
-
- org.eclipse.xtext.xbase.typesystem.references.ArrayTypeReference
-
public class ArrayTypeReference extends LightweightTypeReference
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference
LightweightTypeReference.IdentifierFunction, LightweightTypeReference.JavaIdentifierFunction, LightweightTypeReference.SimpleNameFunction, LightweightTypeReference.UniqueIdentifierFunction
-
-
Field Summary
-
Fields inherited from class org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference
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 Summary
Constructors Constructor Description ArrayTypeReference(ITypeReferenceOwner owner, LightweightTypeReference component)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(TypeReferenceVisitor visitor)<Param> voidaccept(TypeReferenceVisitorWithParameter<Param> visitor, Param param)<Param,Result>
Resultaccept(TypeReferenceVisitorWithParameterAndResult<Param,Result> visitor, Param param)<Result> Resultaccept(TypeReferenceVisitorWithResult<Result> visitor)protected LightweightTypeReferencedoCopyInto(ITypeReferenceOwner owner)LightweightTypeReferencegetComponentType()Returns the component type of the current array type.LightweightTypeReferencegetConstraintSubstitute()Returns the constraint type of this reference.java.lang.StringgetIdentifier()Returns the identifier of this type reference.java.lang.StringgetJavaIdentifier()intgetKind()Subclasses must override this method.LightweightTypeReferencegetNamedType()Returns the named type if this is an anonymous type.LightweightTypeReferencegetRawTypeReference()java.lang.StringgetSimpleName()Prints the simple name of this type reference.LightweightTypeReferencegetSuperType(java.lang.Class<?> rawType)Returns the resolved super type for the given raw type ornullif the raw type is not a valid super type of this type.LightweightTypeReferencegetSuperType(org.eclipse.xtext.common.types.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)org.eclipse.xtext.common.types.JvmArrayTypegetType()java.lang.StringgetUniqueIdentifier()Returns an identifier that allows to disambiguate type parameter names that have different origins.booleanisAnonymous()booleanisArray()booleanisOwnedBy(ITypeReferenceOwner owner)booleanisRawType()Returnstrueis this type points to a raw type.booleanisResolved()booleanisType(java.lang.Class<?> clazz)Returns true if this type reference represents an type with the given raw typeclazz.booleanisUnknown()booleanisVisible(IVisibilityHelper visibilityHelper)Returnstrueif this type is fully visible according to the givenvisibilityHelper.org.eclipse.xtext.common.types.JvmTypeReferencetoJavaCompliantTypeReference(IVisibilityHelper visibilityHelper)Converts this type reference to aJvmTypeReferencethat can be used in Java source code.org.eclipse.xtext.common.types.JvmTypeReferencetoTypeReference()ArrayTypeReferencetryConvertToArray()Returns the array representation of this reference if its represents a subtype ofIterableor already an array itself.LightweightTypeReferencetryConvertToListType()Returns the list representation of this reference if it represents an array or is already a subtype ofList.-
Methods inherited from class org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference
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
-
-
-
-
Constructor Detail
-
ArrayTypeReference
public ArrayTypeReference(ITypeReferenceOwner owner, LightweightTypeReference component)
-
-
Method Detail
-
getKind
public int getKind()
Subclasses must override this method.- Overrides:
getKindin classLightweightTypeReference
-
toTypeReference
public org.eclipse.xtext.common.types.JvmTypeReference toTypeReference()
- Specified by:
toTypeReferencein classLightweightTypeReference
-
isVisible
public boolean isVisible(IVisibilityHelper visibilityHelper)
Description copied from class:LightweightTypeReferenceReturnstrueif this type is fully visible according to the givenvisibilityHelper. All components and bounds are taken into account, e.g.arraysuse theircomponent typeandgenerified typescheck their type arguments, too.- Specified by:
isVisiblein classLightweightTypeReference
-
toJavaCompliantTypeReference
public org.eclipse.xtext.common.types.JvmTypeReference toJavaCompliantTypeReference(IVisibilityHelper visibilityHelper)
Description copied from class:LightweightTypeReferenceConverts this type reference to aJvmTypeReferencethat can be used in Java source code.- Specified by:
toJavaCompliantTypeReferencein classLightweightTypeReference
-
getType
public org.eclipse.xtext.common.types.JvmArrayType getType()
- Specified by:
getTypein classLightweightTypeReference
-
isUnknown
public boolean isUnknown()
- Overrides:
isUnknownin classLightweightTypeReference
-
getSuperTypes
protected java.util.List<LightweightTypeReference> getSuperTypes(TypeParameterSubstitutor<?> substitutor)
- Specified by:
getSuperTypesin classLightweightTypeReference
-
getSuperType
public LightweightTypeReference getSuperType(org.eclipse.xtext.common.types.JvmType rawType)
Description copied from class:LightweightTypeReferenceReturns the resolved super type for the given raw type or null if the raw type is not a valid super type of this type.- Overrides:
getSuperTypein classLightweightTypeReference- Parameters:
rawType- the raw type that should be resolved.- Returns:
- the resolved super type.
-
getSuperType
public LightweightTypeReference getSuperType(java.lang.Class<?> rawType)
Description copied from class:LightweightTypeReferenceReturns the resolved super type for the given raw type ornullif the raw type is not a valid super type of this type.- Overrides:
getSuperTypein classLightweightTypeReference- Parameters:
rawType- the raw type that should be resolved.- Returns:
- the resolved super type.
-
isResolved
public boolean isResolved()
- Overrides:
isResolvedin classLightweightTypeReference
-
isRawType
public boolean isRawType()
Description copied from class:LightweightTypeReferenceReturnstrueis 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.- Overrides:
isRawTypein classLightweightTypeReference
-
isAnonymous
public boolean isAnonymous()
- Overrides:
isAnonymousin classLightweightTypeReference
-
getNamedType
public LightweightTypeReference getNamedType()
Description copied from class:LightweightTypeReferenceReturns the named type if this is an anonymous type.- Overrides:
getNamedTypein classLightweightTypeReference
-
getRawTypeReference
public LightweightTypeReference getRawTypeReference()
- Overrides:
getRawTypeReferencein classLightweightTypeReference- Returns:
- the erasure type of this type reference
-
getConstraintSubstitute
public LightweightTypeReference getConstraintSubstitute()
Description copied from class:LightweightTypeReferenceReturns the constraint type of this reference. The constraint of a type parameter is its declared super type.T extends CharSequence & Serializablehas a compound constraint substitute of the formCharSequence & Serializable.- Overrides:
getConstraintSubstitutein classLightweightTypeReference
-
isOwnedBy
public boolean isOwnedBy(ITypeReferenceOwner owner)
- Overrides:
isOwnedByin classLightweightTypeReference
-
isArray
public boolean isArray()
- Overrides:
isArrayin classLightweightTypeReference
-
tryConvertToListType
public LightweightTypeReference tryConvertToListType()
Description copied from class:LightweightTypeReferenceReturns the list representation of this reference if it represents an array or is already a subtype ofList. If the array's type is a primitive, the list's element type is the wrapper. May returnnullif the conversion is not possible.- Overrides:
tryConvertToListTypein classLightweightTypeReference- Returns:
- an equivalent list type or
null.
-
tryConvertToArray
public ArrayTypeReference tryConvertToArray()
Description copied from class:LightweightTypeReferenceReturns the array representation of this reference if its represents a subtype ofIterableor 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 returnnullif the conversion is not possible.- Overrides:
tryConvertToArrayin classLightweightTypeReference- Returns:
- an equivalent
ArrayTypeReferenceornull.
-
doCopyInto
protected LightweightTypeReference doCopyInto(ITypeReferenceOwner owner)
- Specified by:
doCopyIntoin classLightweightTypeReference
-
getSimpleName
public java.lang.String getSimpleName()
Description copied from class:LightweightTypeReferencePrints the simple name of this type reference. Useful for testing.- Specified by:
getSimpleNamein classLightweightTypeReference
-
getIdentifier
public java.lang.String getIdentifier()
Description copied from class:LightweightTypeReferenceReturns the identifier of this type reference. Usually the qualified name with a dollar delimiter.- Specified by:
getIdentifierin classLightweightTypeReference
-
getUniqueIdentifier
public java.lang.String getUniqueIdentifier()
Description copied from class:LightweightTypeReferenceReturns an identifier that allows to disambiguate type parameter names that have different origins. Rather than just giving the name of the type parameter, it also prints the declarator.- Specified by:
getUniqueIdentifierin classLightweightTypeReference
-
getJavaIdentifier
public java.lang.String getJavaIdentifier()
- Specified by:
getJavaIdentifierin classLightweightTypeReference
-
isType
public boolean isType(java.lang.Class<?> clazz)
Description copied from class:LightweightTypeReferenceReturns true if this type reference represents an type with the given raw typeclazz. Returns false if this is not exactly the given type, but a sub type, a super type or a completely unrelated type.- Specified by:
isTypein classLightweightTypeReference
-
getComponentType
public LightweightTypeReference getComponentType()
Description copied from class:LightweightTypeReferenceReturns the component type of the current array type. Does not attempt to convert this reference from iterable to array, first.- Overrides:
getComponentTypein classLightweightTypeReference- Returns:
- the compoent type of the current array or
null. - See Also:
LightweightTypeReference.isArray()
-
accept
public void accept(TypeReferenceVisitor visitor)
- Overrides:
acceptin classLightweightTypeReference
-
accept
public <Param> void accept(TypeReferenceVisitorWithParameter<Param> visitor, Param param)
- Overrides:
acceptin classLightweightTypeReference
-
accept
public <Result> Result accept(TypeReferenceVisitorWithResult<Result> visitor)
- Overrides:
acceptin classLightweightTypeReference
-
accept
public <Param,Result> Result accept(TypeReferenceVisitorWithParameterAndResult<Param,Result> visitor, Param param)
- Overrides:
acceptin classLightweightTypeReference
-
-