public class StandardTypeReferenceOwner extends java.lang.Object implements ITypeReferenceOwner
ITypeReferenceOwner
.
It is not capable of handling reference resolution or unbound type argument hints.Constructor and 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) |
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.
|
LightweightTypeReferenceFactory |
getFactory() |
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. |
void |
setFactory(LightweightTypeReferenceFactory factory) |
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.
|
public StandardTypeReferenceOwner(CommonTypeComputationServices services, org.eclipse.emf.ecore.resource.ResourceSet context)
public StandardTypeReferenceOwner(CommonTypeComputationServices services, org.eclipse.emf.ecore.EObject context)
public StandardTypeReferenceOwner(CommonTypeComputationServices services, org.eclipse.emf.ecore.resource.Resource context)
public CommonTypeComputationServices getServices()
ITypeReferenceOwner
getServices
in interface ITypeReferenceOwner
public LightweightTypeReferenceFactory getFactory()
public void setFactory(LightweightTypeReferenceFactory factory)
public org.eclipse.emf.ecore.resource.ResourceSet getContextResourceSet()
getContextResourceSet
in interface ITypeReferenceOwner
public void acceptHint(java.lang.Object handle, LightweightBoundTypeArgument boundTypeArgument)
acceptHint
in interface ITypeReferenceOwner
java.lang.UnsupportedOperationException
- alwayspublic java.util.List<LightweightBoundTypeArgument> getAllHints(java.lang.Object handle)
getAllHints
in interface ITypeReferenceOwner
java.lang.UnsupportedOperationException
- alwayspublic boolean isResolved(java.lang.Object handle)
isResolved
in interface ITypeReferenceOwner
java.lang.UnsupportedOperationException
- alwayspublic java.util.List<JvmTypeParameter> getDeclaredTypeParameters()
ITypeReferenceOwner
getDeclaredTypeParameters
in interface ITypeReferenceOwner
public LightweightTypeReference toPlainTypeReference(JvmType type)
ITypeReferenceOwner
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()
.toPlainTypeReference
in interface ITypeReferenceOwner
type
- the type. May not be null.public LightweightTypeReference toLightweightTypeReference(JvmType type)
ITypeReferenceOwner
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.toLightweightTypeReference
in interface ITypeReferenceOwner
type
- the raw type. May not be null
.public LightweightTypeReference toLightweightTypeReference(JvmTypeReference type)
ITypeReferenceOwner
LightweightTypeReference
hierarchy.toLightweightTypeReference
in interface ITypeReferenceOwner
type
- the type to convert. May not be null
.public CompoundTypeReference newCompoundTypeReference(boolean synonym)
ITypeReferenceOwner
CompoundTypeReference
that is either a synonym
or a multi type reference.newCompoundTypeReference
in interface ITypeReferenceOwner
synonym
- whether it should be a synonym type reference.public WildcardTypeReference newWildcardTypeReference()
ITypeReferenceOwner
WildcardTypeReference
without any upper or lower bounds.
Usually clients need to add those to make it a valid type reference.newWildcardTypeReference
in interface ITypeReferenceOwner
public ArrayTypeReference newArrayTypeReference(LightweightTypeReference componentTypeReference)
ITypeReferenceOwner
ArrayTypeReference
with the given component type.newArrayTypeReference
in interface ITypeReferenceOwner
public FunctionTypeReference newFunctionTypeReference(JvmType type)
ITypeReferenceOwner
FunctionTypeReference
that is backed by the given type. Constraints apply
as in ITypeReferenceOwner.newParameterizedTypeReference(JvmType)
.
Clients are responsible to pass a valid SAM type to ITypeReferenceOwner.newFunctionTypeReference(JvmType)
.newFunctionTypeReference
in interface ITypeReferenceOwner
type
- the raw function type.public InnerFunctionTypeReference newFunctionTypeReference(LightweightTypeReference outer, JvmType type)
ITypeReferenceOwner
InnerFunctionTypeReference
that is backed by the given type and has to
defined outer type. Constraints apply as in ITypeReferenceOwner.newFunctionTypeReference(JvmType)
and
ITypeReferenceOwner.newParameterizedTypeReference(LightweightTypeReference, JvmType)
.newFunctionTypeReference
in interface ITypeReferenceOwner
outer
- the outer type reference.type
- the raw type for the newly produced ParameterizedTypeReference
public ParameterizedTypeReference newParameterizedTypeReference(JvmType type)
ITypeReferenceOwner
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.newParameterizedTypeReference
in interface ITypeReferenceOwner
type
- the raw type for the newly produced ParameterizedTypeReference
public InnerTypeReference newParameterizedTypeReference(LightweightTypeReference outer, JvmType type)
ITypeReferenceOwner
InnerTypeReference
. Constraints apply as with ITypeReferenceOwner.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
.newParameterizedTypeReference
in interface ITypeReferenceOwner
outer
- the outer type reference.type
- the raw type for the newly produced ParameterizedTypeReference
public UnknownTypeReference newUnknownTypeReference()
ITypeReferenceOwner
UnknownTypeReference
.newUnknownTypeReference
in interface ITypeReferenceOwner
public UnknownTypeReference newUnknownTypeReference(java.lang.String name)
ITypeReferenceOwner
UnknownTypeReference
.newUnknownTypeReference
in interface ITypeReferenceOwner
public AnyTypeReference newAnyTypeReference()
ITypeReferenceOwner
any type
, e.g. the type of the
value null
.newAnyTypeReference
in interface ITypeReferenceOwner