Interface ITypeReferenceOwner
-
- All Known Implementing Classes:
ResolvedTypes.Owner
,StandardTypeReferenceOwner
,StandardTypeReferenceOwner
public interface ITypeReferenceOwner
Represents the context that defines a valid cluster oftype references
. Clients obtain an instance of theITypeReferenceOwner
by instantiating aStandardTypeReferenceOwner
with a given context (ResourceSet
,Resource
orEObject
).The owner
is used to create new type references from their EMF based counterparts (JvmTypeReference
,JvmType
) or from theirClass
representations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
acceptHint(java.lang.Object handle, LightweightBoundTypeArgument boundTypeArgument)
java.util.List<LightweightBoundTypeArgument>
getAllHints(java.lang.Object handle)
org.eclipse.emf.ecore.resource.ResourceSet
getContextResourceSet()
Returns the context resource set if any.java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter>
getDeclaredTypeParameters()
The currently known type parameters, e.g.CommonTypeComputationServices
getServices()
Access to commonly used services for type references.boolean
isResolved(java.lang.Object handle)
AnyTypeReference
newAnyTypeReference()
Creates a new representation of theany type
, e.g.ArrayTypeReference
newArrayTypeReference(LightweightTypeReference componentTypeReference)
Creates a newArrayTypeReference
with the given component type.CompoundTypeReference
newCompoundTypeReference(boolean synonym)
Creates a newCompoundTypeReference
that is either a synonym or a multi type reference.FunctionTypeReference
newFunctionTypeReference(org.eclipse.xtext.common.types.JvmType type)
Creates a newFunctionTypeReference
that is backed by the given type.InnerFunctionTypeReference
newFunctionTypeReference(LightweightTypeReference outer, org.eclipse.xtext.common.types.JvmType type)
Create a newInnerFunctionTypeReference
that is backed by the given type and has to defined outer type.ParameterizedTypeReference
newParameterizedTypeReference(org.eclipse.xtext.common.types.JvmType type)
Creates a newParameterizedTypeReference
from the given type.InnerTypeReference
newParameterizedTypeReference(LightweightTypeReference outer, org.eclipse.xtext.common.types.JvmType type)
Creates a newInnerTypeReference
.LightweightTypeReference
newReferenceTo(java.lang.Class<?> type)
Creates a reference to the given class or returns anUnknownTypeReference
if no JRE is available.LightweightTypeReference
newReferenceTo(java.lang.Class<?> type, TypeReferenceInitializer<? super ParameterizedTypeReference> init)
Creates a reference to the given class or returns anUnknownTypeReference
if no JRE is available.LightweightTypeReference
newReferenceToObject()
Creates a reference toObject
or returns anUnknownTypeReference
if no JRE is available.UnknownTypeReference
newUnknownTypeReference()
Creates a new unnamedUnknownTypeReference
.UnknownTypeReference
newUnknownTypeReference(java.lang.String name)
Creates a new namedUnknownTypeReference
.WildcardTypeReference
newWildcardExtendsObject()
Creates a wildcard reference toObject
or returns a wildcard to anUnknownTypeReference
if no JRE is available.WildcardTypeReference
newWildcardTypeReference()
Creates a newWildcardTypeReference
without any upper or lower bounds.LightweightTypeReference
toLightweightTypeReference(org.eclipse.xtext.common.types.JvmType type)
Creates a new type reference that points to the given type.LightweightTypeReference
toLightweightTypeReference(org.eclipse.xtext.common.types.JvmTypeReference type)
Transforms the given EMF based type reference to its equivalent in theLightweightTypeReference
hierarchy.LightweightTypeReference
toPlainTypeReference(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 newCompoundTypeReference
that 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 newArrayTypeReference
with the given component type.- Throws:
java.lang.IllegalArgumentException
- if the component type is not valid.
-
newWildcardTypeReference
WildcardTypeReference newWildcardTypeReference()
Creates a newWildcardTypeReference
without 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 newParameterizedTypeReference
from the given type. The type may either be aJvmTypeParameter
,JvmPrimitiveType
,JvmDeclaredType
orJvmVoid
. Other types are considered invalid and will cause anIllegalArgumentException
to 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 aJvmArrayType
ornull
.
-
newParameterizedTypeReference
InnerTypeReference newParameterizedTypeReference(LightweightTypeReference outer, org.eclipse.xtext.common.types.JvmType type)
Creates a newInnerTypeReference
. Constraints apply as withnewParameterizedTypeReference(JvmType)
. Iftype
does 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 newFunctionTypeReference
that 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 newInnerFunctionTypeReference
that 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
, anArrayTypeReference
is produced. The producedLightweightTypeReference
does not have any type arguments. It is similar to a raw type reference except for cases where the type points to aJvmTypeParameter
or 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
, anArrayTypeReference
is produced. The producedLightweightTypeReference
does 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 theLightweightTypeReference
hierarchy.- Parameters:
type
- the type to convert. May not benull
.
-
newReferenceToObject
LightweightTypeReference newReferenceToObject()
Creates a reference toObject
or returns anUnknownTypeReference
if no JRE is available.
-
newWildcardExtendsObject
WildcardTypeReference newWildcardExtendsObject()
Creates a wildcard reference toObject
or returns a wildcard to anUnknownTypeReference
if no JRE is available.
-
newReferenceTo
LightweightTypeReference newReferenceTo(java.lang.Class<?> type)
Creates a reference to the given class or returns anUnknownTypeReference
if no JRE is available.
-
newReferenceTo
LightweightTypeReference newReferenceTo(java.lang.Class<?> type, TypeReferenceInitializer<? super ParameterizedTypeReference> init)
Creates a reference to the given class or returns anUnknownTypeReference
if 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.
-
-