public interface ITypeReferenceOwner
type references. Clients
obtain an instance of the ITypeReferenceOwner by instantiating a StandardTypeReferenceOwner with a
given context (ResourceSet, Resource or EObject).
The owner is used to create new type references from their EMF based counterparts (
JvmTypeReference, JvmType) or from their Class representations.| Modifier and Type | Method and 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 the
any type, e.g. |
ArrayTypeReference |
newArrayTypeReference(LightweightTypeReference componentTypeReference)
Creates a new
ArrayTypeReference with the given component type. |
CompoundTypeReference |
newCompoundTypeReference(boolean synonym)
Creates a new
CompoundTypeReference that is either a synonym
or a multi type reference. |
FunctionTypeReference |
newFunctionTypeReference(org.eclipse.xtext.common.types.JvmType type)
Creates a new
FunctionTypeReference that is backed by the given type. |
InnerFunctionTypeReference |
newFunctionTypeReference(LightweightTypeReference outer,
org.eclipse.xtext.common.types.JvmType type)
Create a new
InnerFunctionTypeReference that is backed by the given type and has to
defined outer type. |
ParameterizedTypeReference |
newParameterizedTypeReference(org.eclipse.xtext.common.types.JvmType type)
Creates a new
ParameterizedTypeReference from the given type. |
InnerTypeReference |
newParameterizedTypeReference(LightweightTypeReference outer,
org.eclipse.xtext.common.types.JvmType type)
Creates a new
InnerTypeReference. |
LightweightTypeReference |
newReferenceTo(java.lang.Class<?> type)
Creates a reference to the given class or returns an
UnknownTypeReference if no
JRE is available. |
LightweightTypeReference |
newReferenceTo(java.lang.Class<?> type,
TypeReferenceInitializer<? super ParameterizedTypeReference> init)
Creates a reference to the given class or returns an
UnknownTypeReference if no
JRE is available. |
LightweightTypeReference |
newReferenceToObject()
Creates a reference to
Object or returns an UnknownTypeReference if no
JRE is available. |
UnknownTypeReference |
newUnknownTypeReference()
Creates a new unnamed
UnknownTypeReference. |
UnknownTypeReference |
newUnknownTypeReference(java.lang.String name)
Creates a new named
UnknownTypeReference. |
WildcardTypeReference |
newWildcardExtendsObject()
Creates a wildcard reference to
Object or returns a wildcard to an UnknownTypeReference if no
JRE is available. |
WildcardTypeReference |
newWildcardTypeReference()
Creates a new
WildcardTypeReference 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 the
LightweightTypeReference
hierarchy. |
LightweightTypeReference |
toPlainTypeReference(org.eclipse.xtext.common.types.JvmType type)
Creates a new type reference that points to the given type.
|
CommonTypeComputationServices getServices()
org.eclipse.emf.ecore.resource.ResourceSet getContextResourceSet()
CompoundTypeReference newCompoundTypeReference(boolean synonym)
CompoundTypeReference that is either a synonym
or a multi type reference.synonym - whether it should be a synonym type reference.ArrayTypeReference newArrayTypeReference(LightweightTypeReference componentTypeReference)
ArrayTypeReference with the given component type.java.lang.IllegalArgumentException - if the component type is not valid.WildcardTypeReference newWildcardTypeReference()
WildcardTypeReference without any upper or lower bounds.
Usually clients need to add those to make it a valid type reference.ParameterizedTypeReference newParameterizedTypeReference(org.eclipse.xtext.common.types.JvmType type)
ParameterizedTypeReference from the given type. The type
may either be a JvmTypeParameter, JvmPrimitiveType, JvmDeclaredType
or JvmVoid. Other types are considered invalid and will cause an IllegalArgumentException
to be thrown.
If the type is a non-static nested type, the produced type reference will be an
InnerTypeReference.
The produced type reference does not have any type arguments. If the given type is generic,
the returned type reference is a raw type.type - the raw type for the newly produced ParameterizedTypeReferencejava.lang.IllegalArgumentException - if the type is a JvmArrayType or null.InnerTypeReference newParameterizedTypeReference(LightweightTypeReference outer, org.eclipse.xtext.common.types.JvmType type)
InnerTypeReference. Constraints apply as with newParameterizedTypeReference(JvmType).
If type does not represent a non-static inner class, an exception is thrown.
This method produces references of the form Outer<OuterParams>.Type.outer - the outer type reference.type - the raw type for the newly produced ParameterizedTypeReferencejava.lang.IllegalArgumentException - if the type is not a valid type for a InnerTypeReference.FunctionTypeReference newFunctionTypeReference(org.eclipse.xtext.common.types.JvmType type)
FunctionTypeReference that is backed by the given type. Constraints apply
as in newParameterizedTypeReference(JvmType).
Clients are responsible to pass a valid SAM type to newFunctionTypeReference(JvmType).type - the raw function type.UnknownTypeReference newUnknownTypeReference()
UnknownTypeReference.UnknownTypeReference newUnknownTypeReference(java.lang.String name)
UnknownTypeReference.AnyTypeReference newAnyTypeReference()
any type, e.g. the type of the
value null.InnerFunctionTypeReference newFunctionTypeReference(LightweightTypeReference outer, org.eclipse.xtext.common.types.JvmType type)
InnerFunctionTypeReference that is backed by the given type and has to
defined outer type. Constraints apply as in newFunctionTypeReference(JvmType) and
newParameterizedTypeReference(LightweightTypeReference, JvmType).outer - the outer type reference.type - the raw type for the newly produced ParameterizedTypeReferencejava.lang.IllegalArgumentException - if the type is not a valid type for a InnerTypeReference.LightweightTypeReference toPlainTypeReference(org.eclipse.xtext.common.types.JvmType type)
JvmArrayType,
an ArrayTypeReference is produced. The produced LightweightTypeReference does not
have any type arguments. It is similar to a raw type reference except for cases where the type
points to a JvmTypeParameter or an array of type parameters. In
those cases, the result is different form toPlainTypeReference(JvmType).
getRawTypeReference().type - the type. May not be null.LightweightTypeReference toLightweightTypeReference(org.eclipse.xtext.common.types.JvmType type)
JvmArrayType,
an ArrayTypeReference is produced. The produced LightweightTypeReference 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.type - the raw type. May not be null.LightweightTypeReference toLightweightTypeReference(org.eclipse.xtext.common.types.JvmTypeReference type)
LightweightTypeReference
hierarchy.type - the type to convert. May not be null.LightweightTypeReference newReferenceToObject()
Object or returns an UnknownTypeReference if no
JRE is available.WildcardTypeReference newWildcardExtendsObject()
Object or returns a wildcard to an UnknownTypeReference if no
JRE is available.LightweightTypeReference newReferenceTo(java.lang.Class<?> type)
UnknownTypeReference if no
JRE is available.LightweightTypeReference newReferenceTo(java.lang.Class<?> type, TypeReferenceInitializer<? super ParameterizedTypeReference> init)
UnknownTypeReference if no
JRE is available. If the type is available, the given acceptor is used to initialize it further.void acceptHint(java.lang.Object handle,
LightweightBoundTypeArgument boundTypeArgument)
java.lang.UnsupportedOperationException - if this owner is not capable of handling unbound type references.java.util.List<LightweightBoundTypeArgument> getAllHints(java.lang.Object handle)
java.lang.UnsupportedOperationException - if this owner is not capable of handling unbound type references.boolean isResolved(java.lang.Object handle)
java.lang.UnsupportedOperationException - if this owner is not capable of handling unbound type references.java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter> getDeclaredTypeParameters()