Class WildcardTypeReference
- java.lang.Object
-
- org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference
-
- org.eclipse.xtext.xbase.typesystem.references.WildcardTypeReference
-
public class WildcardTypeReference 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 WildcardTypeReference(ITypeReferenceOwner owner)
-
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)voidaddUpperBound(LightweightTypeReference upperBound)protected WildcardTypeReferencedoCopyInto(ITypeReferenceOwner owner)java.lang.StringgetIdentifier()Returns the identifier of this type reference.LightweightTypeReferencegetInvariantBoundSubstitute()Returns the invariant bound of this reference.java.lang.StringgetJavaIdentifier()intgetKind()Subclasses must override this method.LightweightTypeReferencegetLowerBound()LightweightTypeReferencegetLowerBoundSubstitute()Returns the lower bound of this reference.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.JvmTypegetType()java.util.List<LightweightTypeReference>getTypeArguments()Returns the type arguments of this reference if it has any.java.lang.StringgetUniqueIdentifier()Returns an identifier that allows to disambiguate type parameter names that have different origins.java.util.List<LightweightTypeReference>getUpperBounds()LightweightTypeReferencegetUpperBoundSubstitute()Returns the upper bound of this reference.booleanhasTypeArguments()booleanisOwnedBy(ITypeReferenceOwner owner)booleanisResolved()booleanisType(java.lang.Class<?> clazz)Returns true if this type reference represents an type with the given raw typeclazz.booleanisUnbounded()Returnstrueif this wilcard is unbounded according to http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.5.1.booleanisVisible(IVisibilityHelper visibilityHelper)Returnstrueif this type is fully visible according to the givenvisibilityHelper.booleanisWildcard()voidsetLowerBound(LightweightTypeReference lowerBound)org.eclipse.xtext.common.types.JvmTypeReferencetoJavaCompliantTypeReference(IVisibilityHelper helper)Converts this type reference to aJvmTypeReferencethat can be used in Java source code.org.eclipse.xtext.common.types.JvmTypeReferencetoTypeReference()-
Methods inherited from class org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference
collectSuperTypes, collectSuperTypes, copyInto, createSubstitutor, expose, findNonNullType, findType, getAllSuperTypes, getAsFunctionTypeReference, getComponentType, getConstraintSubstitute, getFunctionTypeKind, getHumanReadableName, getMultiTypeComponents, getNamedType, getNonInterfaceTypes, getOuter, getOwner, getPrimitiveIfWrapperType, getPrimitiveKind, getPrimitiveKindIfWrapperType, getRawTypeReference, getRawTypes, getServices, getSuperTypes, getTypesFactory, getUniqueIdentifier, getWrapperTypeIfPrimitive, internalFindTopLevelType, internalIsAssignableFrom, isAnonymous, isAny, isArray, isAssignableFrom, isAssignableFrom, isAssignableFrom, isAssignableFrom, isFunctionType, isInterfaceType, isMultiType, isPrimitive, isPrimitiveVoid, isRawType, isSubtypeOf, isSubtypeOf, isSynonym, isUnknown, isValidHint, isWrapper, toJavaCompliantTypeReference, toJavaCompliantTypeReference, toJavaType, toString, tryConvertToArray, tryConvertToFunctionTypeReference, tryConvertToListType
-
-
-
-
Constructor Detail
-
WildcardTypeReference
public WildcardTypeReference(ITypeReferenceOwner owner)
-
-
Method Detail
-
getKind
public int getKind()
Subclasses must override this method.- Overrides:
getKindin classLightweightTypeReference
-
isResolved
public boolean isResolved()
- Overrides:
isResolvedin classLightweightTypeReference
-
getTypeArguments
public java.util.List<LightweightTypeReference> getTypeArguments()
Description copied from class:LightweightTypeReferenceReturns the type arguments of this reference if it has any. The type argument ofList<String>isString.is also the type argument of a wildcard reference with upper bound ? extends List<String>. Raw types don't carry type arguments. Wildcards with more than one upper bound don't carry type arguments.- Overrides:
getTypeArgumentsin classLightweightTypeReference
-
hasTypeArguments
public boolean hasTypeArguments()
- Overrides:
hasTypeArgumentsin classLightweightTypeReference
-
getUpperBounds
public java.util.List<LightweightTypeReference> getUpperBounds()
-
isUnbounded
public boolean isUnbounded()
Returnstrueif this wilcard is unbounded according to http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.5.1. Unbounded wildcards do not have any upper or lower bound defined. Unbounded references are only useful on the source level since at runtime an unbound wildcard type gets Object as upper bound (seeWildcardType.getUpperBounds().
-
getLowerBound
public LightweightTypeReference getLowerBound()
-
isOwnedBy
public boolean isOwnedBy(ITypeReferenceOwner owner)
- Overrides:
isOwnedByin classLightweightTypeReference
-
doCopyInto
protected WildcardTypeReference doCopyInto(ITypeReferenceOwner owner)
- Specified by:
doCopyIntoin 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
-
getUpperBoundSubstitute
public LightweightTypeReference getUpperBoundSubstitute()
Description copied from class:LightweightTypeReferenceReturns the upper bound of this reference. The upper bound of a wildcard reference is its upper constraint, e.g.? extends CharSequencehas the upper boundCharSequence.- Overrides:
getUpperBoundSubstitutein classLightweightTypeReference
-
getLowerBoundSubstitute
public LightweightTypeReference getLowerBoundSubstitute()
Description copied from class:LightweightTypeReferenceReturns the lower bound of this reference. The lower bound of a wildcard reference is its lower constraint, e.g.? super CharSequencehas the upper boundCharSequence.- Overrides:
getLowerBoundSubstitutein classLightweightTypeReference
-
getInvariantBoundSubstitute
public LightweightTypeReference getInvariantBoundSubstitute()
Description copied from class:LightweightTypeReferenceReturns the invariant bound of this reference. The invariant bound of a wildcard reference is its lower constraint, if any. Otherwise it's the upper bound.- Overrides:
getInvariantBoundSubstitutein 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.
-
toTypeReference
public org.eclipse.xtext.common.types.JvmTypeReference toTypeReference()
- Specified by:
toTypeReferencein classLightweightTypeReference
-
toJavaCompliantTypeReference
public org.eclipse.xtext.common.types.JvmTypeReference toJavaCompliantTypeReference(IVisibilityHelper helper)
Description copied from class:LightweightTypeReferenceConverts this type reference to aJvmTypeReferencethat can be used in Java source code.- Specified by:
toJavaCompliantTypeReferencein 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
-
addUpperBound
public void addUpperBound(LightweightTypeReference upperBound)
-
setLowerBound
public void setLowerBound(LightweightTypeReference lowerBound)
-
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
-
getType
public org.eclipse.xtext.common.types.JvmType getType()
- Specified by:
getTypein classLightweightTypeReference
-
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
-
isWildcard
public boolean isWildcard()
- Overrides:
isWildcardin classLightweightTypeReference
-
-