public abstract class AbstractTypeResolver<PK,C,O,P,PM> extends Object implements TypeResolver<C,O,P>
TypeResolver
interface, useful for
providers of environment implementations to build their type resolvers.
It is recommended that clients extend this class to customize resolution of types based on their models, rather than implementing the interface. Simply override a few protected methods for creating metamodel-specific constructs.
See the Environment
class for a description of the
generic type parameters of this class.
Constructor and Description |
---|
AbstractTypeResolver(Environment<PK,C,O,P,?,PM,?,?,?,?,?,?> env)
Initializes me with an environment.
|
AbstractTypeResolver(Environment<PK,C,O,P,?,PM,?,?,?,?,?,?> env,
Resource resource)
Initializes me with a resource in which I will persist the model-based
types that I generate in my associated
Environment . |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes me by unloading my resource, if and only if I created it in
the first place.
|
List<P> |
getAdditionalAttributes(C owner)
Obtains the additional attributes defined (via OCL) in the specified
classifier context.
|
PK |
getAdditionalFeaturesPackage()
Obtains the package containing the additional operations and properties
parsed in my environment.
|
List<O> |
getAdditionalOperations(C owner)
Obtains the additional operations defined (via OCL) in the specified
classifier context.
|
PK |
getCollectionPackage()
Obtains the package containing the collection types that I generate.
|
PK |
getMessagePackage()
Obtains the package containing the message types that I generate.
|
Resource |
getResource()
Obtains the resource in which the types that I generate are stored for
persistence.
|
PK |
getTuplePackage()
Obtains the package containing the tuple types that I generate.
|
PK |
getTypePackage()
Obtains the package containing the type types that I generate.
|
C |
resolve(C type)
Resolves the specified
type , returning my own persistent
type instance representing the same OCL type. |
P |
resolveAdditionalAttribute(C owner,
P property)
Resolves the specified "additional attribute" defined by the OCL client
on the specified
owner type. |
O |
resolveAdditionalOperation(C owner,
O operation)
Resolves the specified "additional operation" defined by the OCL client
on the specified
owner type. |
CollectionType<C,O> |
resolveCollectionType(CollectionKind kind,
C elementType)
Resolves the collection type of the specified
kind and
element type, either created anew or previously created. |
MessageType<C,O,P> |
resolveOperationMessageType(O operation)
Resolves the type for a message expression referencing the specified
operation . |
MessageType<C,O,P> |
resolveSignalMessageType(C signal)
Resolves the type for a message expression referencing the specified
signal . |
TupleType<O,P> |
resolveTupleType(<any> parts)
Resolves the tuple type consisting of the specified
parts ,
in no particular order, either created anew or previously created. |
TypeType<C,O> |
resolveTypeType(C type)
Resolves the type for a type expression referencing the specified
type . |
public AbstractTypeResolver(Environment<PK,C,O,P,?,PM,?,?,?,?,?,?> env)
env
- the environment that I persistpublic AbstractTypeResolver(Environment<PK,C,O,P,?,PM,?,?,?,?,?,?> env, Resource resource)
Environment
.env
- my environmentresource
- my resourcepublic C resolve(C type)
TypeResolver
type
, returning my own persistent
type instance representing the same OCL type.
The type
may have been newly created by the parser and be
a duplicate of a type previously resolved, or it may actually be a
type that was previously resolved. In the latter case, the
type
is returned as is. The null
type is
considered to be resolved (i.e., the result is also null
).
Usually, this method will delegate to one of the
resolveXyzType()
methods defined by this interface.
resolve
in interface TypeResolver<C,O,P>
type
- a type to resolvetype
if it is already resolvedpublic Resource getResource()
TypeResolver
getResource
in interface TypeResolver<C,O,P>
public PK getCollectionPackage()
public CollectionType<C,O> resolveCollectionType(CollectionKind kind, C elementType)
TypeResolver
kind
and
element type, either created anew or previously created.resolveCollectionType
in interface TypeResolver<C,O,P>
kind
- the kind of collection type to createelementType
- the element typepublic PK getTuplePackage()
public TupleType<O,P> resolveTupleType(<any> parts)
TypeResolver
parts
,
in no particular order, either created anew or previously created. The
resulting type is uniquely defined by the names and types of its parts, and
twp tuple types are considered equal if they have the same number of parts
and their parts correspond one-for-one in name and type (order is not
significant).resolveTupleType
in interface TypeResolver<C,O,P>
parts
- a list of TypedElement
s defining the name and type of
each tuple part. The part names are uniquepublic PK getTypePackage()
public TypeType<C,O> resolveTypeType(C type)
TypeResolver
type
. This is, effectively, the OCL metatype counterpart
for the specified model type.resolveTypeType
in interface TypeResolver<C,O,P>
type
- a model typepublic PK getMessagePackage()
public MessageType<C,O,P> resolveOperationMessageType(O operation)
TypeResolver
operation
.resolveOperationMessageType
in interface TypeResolver<C,O,P>
operation
- the operation call that the message representspublic MessageType<C,O,P> resolveSignalMessageType(C signal)
TypeResolver
signal
.resolveSignalMessageType
in interface TypeResolver<C,O,P>
signal
- the signal send that the message representspublic PK getAdditionalFeaturesPackage()
public O resolveAdditionalOperation(C owner, O operation)
TypeResolver
owner
type.resolveAdditionalOperation
in interface TypeResolver<C,O,P>
owner
- the type on which the additional operation is definedoperation
- the additional operationpublic List<O> getAdditionalOperations(C owner)
TypeResolver
getAdditionalOperations
in interface TypeResolver<C,O,P>
owner
- the context classifierpublic P resolveAdditionalAttribute(C owner, P property)
TypeResolver
owner
type.resolveAdditionalAttribute
in interface TypeResolver<C,O,P>
owner
- the type on which the additional attribute is definedproperty
- the additional attributepublic List<P> getAdditionalAttributes(C owner)
TypeResolver
getAdditionalAttributes
in interface TypeResolver<C,O,P>
owner
- the context classifierpublic void dispose()
Copyright © 2005, 2018 IBM Corporation and others. All Rights Reserved.