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<JvmTypeParameter> |
getDeclaredTypeParameters()
The currently known type parameters, e.g. the ones that should not be substituted.
|
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. the type of the
value null . |
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(JvmType type)
Creates a new
FunctionTypeReference that is backed by the given type. |
InnerFunctionTypeReference |
newFunctionTypeReference(LightweightTypeReference outer,
JvmType type)
Create a new
InnerFunctionTypeReference that is backed by the given type and has to
defined outer type. |
ParameterizedTypeReference |
newParameterizedTypeReference(JvmType type)
Creates a new
ParameterizedTypeReference from the given type. |
InnerTypeReference |
newParameterizedTypeReference(LightweightTypeReference outer,
JvmType type)
Creates a new
InnerTypeReference . |
UnknownTypeReference |
newUnknownTypeReference()
Creates a new unnamed
UnknownTypeReference . |
UnknownTypeReference |
newUnknownTypeReference(java.lang.String name)
Creates a new named
UnknownTypeReference . |
WildcardTypeReference |
newWildcardTypeReference()
Creates a new
WildcardTypeReference without any upper or lower bounds. |
LightweightTypeReference |
toLightweightTypeReference(JvmType type)
Creates a new type reference that points to the given type.
|
LightweightTypeReference |
toLightweightTypeReference(JvmTypeReference type)
Transforms the given EMF based type reference to its equivalent in the
LightweightTypeReference
hierarchy. |
LightweightTypeReference |
toPlainTypeReference(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(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 ParameterizedTypeReference
java.lang.IllegalArgumentException
- if the type is a JvmArrayType
or null
.InnerTypeReference newParameterizedTypeReference(LightweightTypeReference outer, 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 ParameterizedTypeReference
java.lang.IllegalArgumentException
- if the type is not a valid type for a InnerTypeReference
.FunctionTypeReference newFunctionTypeReference(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, 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 ParameterizedTypeReference
java.lang.IllegalArgumentException
- if the type is not a valid type for a InnerTypeReference
.LightweightTypeReference toPlainTypeReference(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(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(JvmTypeReference type)
LightweightTypeReference
hierarchy.type
- the type to convert. May not be null
.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<JvmTypeParameter> getDeclaredTypeParameters()