Interface ITypeReferenceOwner
-
- All Known Implementing Classes:
ResolvedTypes.Owner,StandardTypeReferenceOwner,StandardTypeReferenceOwner
public interface ITypeReferenceOwnerRepresents the context that defines a valid cluster oftype references. Clients obtain an instance of theITypeReferenceOwnerby instantiating aStandardTypeReferenceOwnerwith a given context (ResourceSet,ResourceorEObject).The owneris used to create new type references from their EMF based counterparts (JvmTypeReference,JvmType) or from theirClassrepresentations.
-
-
Method Summary
All Methods Instance Methods Abstract 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.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 reference to the given class or returns anUnknownTypeReferenceif no JRE is available.LightweightTypeReferencenewReferenceTo(java.lang.Class<?> type, TypeReferenceInitializer<? super ParameterizedTypeReference> init)Creates a reference to the given class or returns anUnknownTypeReferenceif no JRE is available.LightweightTypeReferencenewReferenceToObject()Creates a reference 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.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.
-
-
-
Method Detail
-
getServices
CommonTypeComputationServices getServices()
Access to commonly used services for type references.
-
getContextResourceSet
org.eclipse.emf.ecore.resource.ResourceSet getContextResourceSet()
Returns the context resource set if any. May return null if there is no context information available. In those cases, the owner is rather useless.
-
newCompoundTypeReference
CompoundTypeReference newCompoundTypeReference(boolean synonym)
Creates a newCompoundTypeReferencethat is either a synonym or a multi type reference.- Parameters:
synonym- whether it should be a synonym type reference.
-
newArrayTypeReference
ArrayTypeReference newArrayTypeReference(LightweightTypeReference componentTypeReference)
Creates a newArrayTypeReferencewith the given component type.- Throws:
java.lang.IllegalArgumentException- if the component type is not valid.
-
newWildcardTypeReference
WildcardTypeReference newWildcardTypeReference()
Creates a newWildcardTypeReferencewithout any upper or lower bounds. Usually clients need to add those to make it a valid type reference.
-
newParameterizedTypeReference
ParameterizedTypeReference newParameterizedTypeReference(org.eclipse.xtext.common.types.JvmType type)
Creates 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.- Parameters:
type- the raw type for the newly producedParameterizedTypeReference- Throws:
java.lang.IllegalArgumentException- if the type is aJvmArrayTypeornull.
-
newParameterizedTypeReference
InnerTypeReference newParameterizedTypeReference(LightweightTypeReference outer, org.eclipse.xtext.common.types.JvmType type)
Creates a newInnerTypeReference. Constraints apply as withnewParameterizedTypeReference(JvmType). Iftypedoes not represent a non-static inner class, an exception is thrown. This method produces references of the formOuter<OuterParams>.Type.- Parameters:
outer- the outer type reference.type- the raw type for the newly producedParameterizedTypeReference- Throws:
java.lang.IllegalArgumentException- if the type is not a valid type for aInnerTypeReference.
-
newFunctionTypeReference
FunctionTypeReference newFunctionTypeReference(org.eclipse.xtext.common.types.JvmType type)
Creates a newFunctionTypeReferencethat is backed by the given type. Constraints apply as innewParameterizedTypeReference(JvmType). Clients are responsible to pass a valid SAM type tonewFunctionTypeReference(JvmType).- Parameters:
type- the raw function type.
-
newUnknownTypeReference
UnknownTypeReference newUnknownTypeReference()
Creates a new unnamedUnknownTypeReference.
-
newUnknownTypeReference
UnknownTypeReference newUnknownTypeReference(java.lang.String name)
Creates a new namedUnknownTypeReference.
-
newAnyTypeReference
AnyTypeReference newAnyTypeReference()
Creates a new representation of theany type, e.g. the type of the valuenull.
-
newFunctionTypeReference
InnerFunctionTypeReference newFunctionTypeReference(LightweightTypeReference outer, org.eclipse.xtext.common.types.JvmType type)
Create a newInnerFunctionTypeReferencethat is backed by the given type and has to defined outer type. Constraints apply as innewFunctionTypeReference(JvmType)andnewParameterizedTypeReference(LightweightTypeReference, JvmType).- Parameters:
outer- the outer type reference.type- the raw type for the newly producedParameterizedTypeReference- Throws:
java.lang.IllegalArgumentException- if the type is not a valid type for aInnerTypeReference.
-
toPlainTypeReference
LightweightTypeReference toPlainTypeReference(org.eclipse.xtext.common.types.JvmType type)
Creates 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().- Parameters:
type- the type. May not be null.
-
toLightweightTypeReference
LightweightTypeReference toLightweightTypeReference(org.eclipse.xtext.common.types.JvmType type)
Creates 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.- Parameters:
type- the raw type. May not benull.
-
toLightweightTypeReference
LightweightTypeReference toLightweightTypeReference(org.eclipse.xtext.common.types.JvmTypeReference type)
Transforms the given EMF based type reference to its equivalent in theLightweightTypeReferencehierarchy.- Parameters:
type- the type to convert. May not benull.
-
newReferenceToObject
LightweightTypeReference newReferenceToObject()
Creates a reference toObjector returns anUnknownTypeReferenceif no JRE is available.
-
newWildcardExtendsObject
WildcardTypeReference newWildcardExtendsObject()
Creates a wildcard reference toObjector returns a wildcard to anUnknownTypeReferenceif no JRE is available.
-
newReferenceTo
LightweightTypeReference newReferenceTo(java.lang.Class<?> type)
Creates a reference to the given class or returns anUnknownTypeReferenceif no JRE is available.
-
newReferenceTo
LightweightTypeReference newReferenceTo(java.lang.Class<?> type, TypeReferenceInitializer<? super ParameterizedTypeReference> init)
Creates a reference 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.
-
acceptHint
void acceptHint(java.lang.Object handle, LightweightBoundTypeArgument boundTypeArgument)- Throws:
java.lang.UnsupportedOperationException- if this owner is not capable of handling unbound type references.
-
getAllHints
java.util.List<LightweightBoundTypeArgument> getAllHints(java.lang.Object handle)
- Throws:
java.lang.UnsupportedOperationException- if this owner is not capable of handling unbound type references.
-
isResolved
boolean isResolved(java.lang.Object handle)
- Throws:
java.lang.UnsupportedOperationException- if this owner is not capable of handling unbound type references.
-
getDeclaredTypeParameters
java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter> getDeclaredTypeParameters()
The currently known type parameters, e.g. the ones that should not be substituted.
-
-