Class StandardTypeReferenceOwner
- java.lang.Object
-
- org.eclipse.xtext.xbase.typesystem.references.StandardTypeReferenceOwner
-
- All Implemented Interfaces:
ITypeReferenceOwner
- Direct Known Subclasses:
ResolvedTypes.Owner,StandardTypeReferenceOwner
public class StandardTypeReferenceOwner extends java.lang.Object implements ITypeReferenceOwner
Plain instantiable implementation of theITypeReferenceOwner. It is not capable of handling reference resolution or unbound type argument hints.
-
-
Constructor Summary
Constructors Constructor Description StandardTypeReferenceOwner(CommonTypeComputationServices services, org.eclipse.emf.ecore.EObject context)StandardTypeReferenceOwner(CommonTypeComputationServices services, org.eclipse.emf.ecore.resource.Resource context)StandardTypeReferenceOwner(CommonTypeComputationServices services, org.eclipse.emf.ecore.resource.ResourceSet context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacceptHint(java.lang.Object handle, LightweightBoundTypeArgument boundTypeArgument)java.util.List<LightweightBoundTypeArgument>getAllHints(java.lang.Object handle)org.eclipse.emf.ecore.resource.ResourceSetgetContextResourceSet()Returns the context resource set if any.java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter>getDeclaredTypeParameters()The currently known type parameters, e.g.LightweightTypeReferenceFactorygetFactory()CommonTypeComputationServicesgetServices()Access to commonly used services for type references.booleanisResolved(java.lang.Object handle)AnyTypeReferencenewAnyTypeReference()Creates a new representation of theany type, e.g.ArrayTypeReferencenewArrayTypeReference(LightweightTypeReference componentTypeReference)Creates a newArrayTypeReferencewith the given component type.CompoundTypeReferencenewCompoundTypeReference(boolean synonym)Creates a newCompoundTypeReferencethat is either a synonym or a multi type reference.FunctionTypeReferencenewFunctionTypeReference(org.eclipse.xtext.common.types.JvmType type)Creates a newFunctionTypeReferencethat is backed by the given type.InnerFunctionTypeReferencenewFunctionTypeReference(LightweightTypeReference outer, org.eclipse.xtext.common.types.JvmType type)Create a newInnerFunctionTypeReferencethat is backed by the given type and has to defined outer type.ParameterizedTypeReferencenewParameterizedTypeReference(org.eclipse.xtext.common.types.JvmType type)Creates a newParameterizedTypeReferencefrom the given type.InnerTypeReferencenewParameterizedTypeReference(LightweightTypeReference outer, org.eclipse.xtext.common.types.JvmType type)Creates a newInnerTypeReference.LightweightTypeReferencenewReferenceTo(java.lang.Class<?> type)Creates a references to the given class or returns anUnknownTypeReferenceif no JRE is available.LightweightTypeReferencenewReferenceTo(java.lang.Class<?> type, TypeReferenceInitializer<? super ParameterizedTypeReference> init)Creates a references to the given class or returns anUnknownTypeReferenceif no JRE is available.LightweightTypeReferencenewReferenceToObject()Creates a references toObjector returns anUnknownTypeReferenceif no JRE is available.UnknownTypeReferencenewUnknownTypeReference()Creates a new unnamedUnknownTypeReference.UnknownTypeReferencenewUnknownTypeReference(java.lang.String name)Creates a new namedUnknownTypeReference.WildcardTypeReferencenewWildcardExtendsObject()Creates a wildcard reference toObjector returns a wildcard to anUnknownTypeReferenceif no JRE is available.WildcardTypeReferencenewWildcardTypeReference()Creates a newWildcardTypeReferencewithout any upper or lower bounds.voidsetFactory(LightweightTypeReferenceFactory factory)LightweightTypeReferencetoLightweightTypeReference(org.eclipse.xtext.common.types.JvmType type)Creates a new type reference that points to the given type.LightweightTypeReferencetoLightweightTypeReference(org.eclipse.xtext.common.types.JvmTypeReference type)Transforms the given EMF based type reference to its equivalent in theLightweightTypeReferencehierarchy.LightweightTypeReferencetoPlainTypeReference(org.eclipse.xtext.common.types.JvmType type)Creates a new type reference that points to the given type.
-
-
-
Constructor Detail
-
StandardTypeReferenceOwner
public StandardTypeReferenceOwner(CommonTypeComputationServices services, org.eclipse.emf.ecore.resource.ResourceSet context)
-
StandardTypeReferenceOwner
public StandardTypeReferenceOwner(CommonTypeComputationServices services, org.eclipse.emf.ecore.EObject context)
-
StandardTypeReferenceOwner
public StandardTypeReferenceOwner(CommonTypeComputationServices services, org.eclipse.emf.ecore.resource.Resource context)
-
-
Method Detail
-
getServices
public CommonTypeComputationServices getServices()
Description copied from interface:ITypeReferenceOwnerAccess to commonly used services for type references.- Specified by:
getServicesin interfaceITypeReferenceOwner
-
getFactory
public LightweightTypeReferenceFactory getFactory()
-
setFactory
public void setFactory(LightweightTypeReferenceFactory factory)
-
getContextResourceSet
public org.eclipse.emf.ecore.resource.ResourceSet getContextResourceSet()
Returns the context resource set if any.- Specified by:
getContextResourceSetin interfaceITypeReferenceOwner
-
acceptHint
public void acceptHint(java.lang.Object handle, LightweightBoundTypeArgument boundTypeArgument)- Specified by:
acceptHintin interfaceITypeReferenceOwner- Throws:
java.lang.UnsupportedOperationException- always
-
getAllHints
public java.util.List<LightweightBoundTypeArgument> getAllHints(java.lang.Object handle)
- Specified by:
getAllHintsin interfaceITypeReferenceOwner- Throws:
java.lang.UnsupportedOperationException- always
-
isResolved
public boolean isResolved(java.lang.Object handle)
- Specified by:
isResolvedin interfaceITypeReferenceOwner- Throws:
java.lang.UnsupportedOperationException- always
-
getDeclaredTypeParameters
public java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter> getDeclaredTypeParameters()
Description copied from interface:ITypeReferenceOwnerThe currently known type parameters, e.g. the ones that should not be substituted.- Specified by:
getDeclaredTypeParametersin interfaceITypeReferenceOwner- Returns:
- the empty list
-
toPlainTypeReference
public LightweightTypeReference toPlainTypeReference(org.eclipse.xtext.common.types.JvmType type)
Description copied from interface:ITypeReferenceOwnerCreates a new type reference that points to the given type. If the type is aJvmArrayType, anArrayTypeReferenceis produced. The producedLightweightTypeReferencedoes not have any type arguments. It is similar to a raw type reference except for cases where the type points to aJvmTypeParameteror an array oftype parameters. In those cases, the result is different formtoPlainTypeReference(JvmType).getRawTypeReference().- Specified by:
toPlainTypeReferencein interfaceITypeReferenceOwner- Parameters:
type- the type. May not be null.
-
toLightweightTypeReference
public LightweightTypeReference toLightweightTypeReference(org.eclipse.xtext.common.types.JvmType type)
Description copied from interface:ITypeReferenceOwnerCreates a new type reference that points to the given type. If the type is aJvmArrayType, anArrayTypeReferenceis produced. The producedLightweightTypeReferencedoes have type arguments if the given type is generic or an array of a generic type. The type arguments point to the original type parameters. Useful for later substitution of all type parameters.- Specified by:
toLightweightTypeReferencein interfaceITypeReferenceOwner- Parameters:
type- the raw type. May not benull.
-
toLightweightTypeReference
public LightweightTypeReference toLightweightTypeReference(org.eclipse.xtext.common.types.JvmTypeReference type)
Description copied from interface:ITypeReferenceOwnerTransforms the given EMF based type reference to its equivalent in theLightweightTypeReferencehierarchy.- Specified by:
toLightweightTypeReferencein interfaceITypeReferenceOwner- Parameters:
type- the type to convert. May not benull.
-
newCompoundTypeReference
public CompoundTypeReference newCompoundTypeReference(boolean synonym)
Description copied from interface:ITypeReferenceOwnerCreates a newCompoundTypeReferencethat is either a synonym or a multi type reference.- Specified by:
newCompoundTypeReferencein interfaceITypeReferenceOwner- Parameters:
synonym- whether it should be a synonym type reference.
-
newWildcardTypeReference
public WildcardTypeReference newWildcardTypeReference()
Description copied from interface:ITypeReferenceOwnerCreates a newWildcardTypeReferencewithout any upper or lower bounds. Usually clients need to add those to make it a valid type reference.- Specified by:
newWildcardTypeReferencein interfaceITypeReferenceOwner
-
newArrayTypeReference
public ArrayTypeReference newArrayTypeReference(LightweightTypeReference componentTypeReference)
Description copied from interface:ITypeReferenceOwnerCreates a newArrayTypeReferencewith the given component type.- Specified by:
newArrayTypeReferencein interfaceITypeReferenceOwner
-
newFunctionTypeReference
public FunctionTypeReference newFunctionTypeReference(org.eclipse.xtext.common.types.JvmType type)
Description copied from interface:ITypeReferenceOwnerCreates a newFunctionTypeReferencethat is backed by the given type. Constraints apply as inITypeReferenceOwner.newParameterizedTypeReference(JvmType). Clients are responsible to pass a valid SAM type toITypeReferenceOwner.newFunctionTypeReference(JvmType).- Specified by:
newFunctionTypeReferencein interfaceITypeReferenceOwner- Parameters:
type- the raw function type.
-
newFunctionTypeReference
public InnerFunctionTypeReference newFunctionTypeReference(LightweightTypeReference outer, org.eclipse.xtext.common.types.JvmType type)
Description copied from interface:ITypeReferenceOwnerCreate a newInnerFunctionTypeReferencethat is backed by the given type and has to defined outer type. Constraints apply as inITypeReferenceOwner.newFunctionTypeReference(JvmType)andITypeReferenceOwner.newParameterizedTypeReference(LightweightTypeReference, JvmType).- Specified by:
newFunctionTypeReferencein interfaceITypeReferenceOwner- Parameters:
outer- the outer type reference.type- the raw type for the newly producedParameterizedTypeReference
-
newParameterizedTypeReference
public ParameterizedTypeReference newParameterizedTypeReference(org.eclipse.xtext.common.types.JvmType type)
Description copied from interface:ITypeReferenceOwnerCreates a newParameterizedTypeReferencefrom the given type. The type may either be aJvmTypeParameter,JvmPrimitiveType,JvmDeclaredTypeorJvmVoid. Other types are considered invalid and will cause anIllegalArgumentExceptionto be thrown. If the type is a non-static nested type, the produced type reference will be anInnerTypeReference. The produced type reference does not have any type arguments. If the given type is generic, the returned type reference is a raw type.- Specified by:
newParameterizedTypeReferencein interfaceITypeReferenceOwner- Parameters:
type- the raw type for the newly producedParameterizedTypeReference
-
newParameterizedTypeReference
public InnerTypeReference newParameterizedTypeReference(LightweightTypeReference outer, org.eclipse.xtext.common.types.JvmType type)
Description copied from interface:ITypeReferenceOwnerCreates a newInnerTypeReference. Constraints apply as withITypeReferenceOwner.newParameterizedTypeReference(JvmType). Iftypedoes not represent a non-static inner class, an exception is thrown. This method produces references of the formOuter<OuterParams>.Type.- Specified by:
newParameterizedTypeReferencein interfaceITypeReferenceOwner- Parameters:
outer- the outer type reference.type- the raw type for the newly producedParameterizedTypeReference
-
newUnknownTypeReference
public UnknownTypeReference newUnknownTypeReference()
Description copied from interface:ITypeReferenceOwnerCreates a new unnamedUnknownTypeReference.- Specified by:
newUnknownTypeReferencein interfaceITypeReferenceOwner
-
newUnknownTypeReference
public UnknownTypeReference newUnknownTypeReference(java.lang.String name)
Description copied from interface:ITypeReferenceOwnerCreates a new namedUnknownTypeReference.- Specified by:
newUnknownTypeReferencein interfaceITypeReferenceOwner
-
newAnyTypeReference
public AnyTypeReference newAnyTypeReference()
Description copied from interface:ITypeReferenceOwnerCreates a new representation of theany type, e.g. the type of the valuenull.- Specified by:
newAnyTypeReferencein interfaceITypeReferenceOwner
-
newReferenceToObject
public LightweightTypeReference newReferenceToObject()
Creates a references toObjector returns anUnknownTypeReferenceif no JRE is available.- Specified by:
newReferenceToObjectin interfaceITypeReferenceOwner
-
newWildcardExtendsObject
public WildcardTypeReference newWildcardExtendsObject()
Creates a wildcard reference toObjector returns a wildcard to anUnknownTypeReferenceif no JRE is available.- Specified by:
newWildcardExtendsObjectin interfaceITypeReferenceOwner
-
newReferenceTo
public LightweightTypeReference newReferenceTo(java.lang.Class<?> type)
Creates a references to the given class or returns anUnknownTypeReferenceif no JRE is available.- Specified by:
newReferenceToin interfaceITypeReferenceOwner
-
newReferenceTo
public LightweightTypeReference newReferenceTo(java.lang.Class<?> type, TypeReferenceInitializer<? super ParameterizedTypeReference> init)
Creates a references to the given class or returns anUnknownTypeReferenceif no JRE is available. If the type is available, the given acceptor is used to initialize it further.- Specified by:
newReferenceToin interfaceITypeReferenceOwner
-
-