## org.eclipse.ocl.utilities
Interface UMLReflection<PK,C,O,P,EL,PM,S,COA,SSA,CT>

All Known Implementing Classes:
  UMLReflectionImpl

    public interface UMLReflection<PK,C,O,P,EL,PM,S,COA,SSA,CT>

An interface providing reflection service for the metaclasses that the OCL borrows from UML.

See the `Environment` class for a description of the generic type parameters of this interface.

Field Summary
`static String` `BODY` Stereotype applied to operation body conditions.
`static String` `DEFINITION` Stereotype applied definition expressions.
`static String` `DERIVATION` Stereotype applied derived value expressions.
`static String` `INITIAL` Stereotype applied initial value expressions.
`static String` `INVARIANT` Stereotype applied to classifier invariant constraints.
`static String` `OCL_HELPER` Stereotype applied to herlp attributes and operations defined by definition constraints.
`static String` `POSTCONDITION` Stereotype applied to operation postcondition constraints.
`static String` `PRECONDITION` Stereotype applied to operation precondition constraints.
`static int` `RELATED_TYPE` Mask for testing the result of the `getRelationship(C, C)` method, to check whether the first classifier is related by generalization to the second classifier (being either a supertype or a subtype of it, including possibly the same type).
`static int` `SAME_TYPE` Result of `getRelationship(C, C)` indicating that two classifiers are, in fact, the same type.
`static int` `STRICT_SUBTYPE` Result of `getRelationship(C, C)` indicating that the first classifier is a strict subtype of the second.
`static int` `STRICT_SUPERTYPE` Result of `getRelationship(C, C)` indicating that the first classifier is a strict supertype of the second.
`static int` `SUBTYPE` Mask for testing the result of the `getRelationship(C, C)` method, to check whether the first classifier is the same type as or a strict subtype of the second.
`static int` `SUPERTYPE` Mask for testing the result of the `getRelationship(C, C)` method, to check whether the first classifier is the same type as or a strict supertype of the second.
`static int` `UNRELATED_TYPE` Result of `getRelationship(C, C)` indicating that the first classifier is not related by generalization to the second classifier (being different from it and neither a subtype nor a supertype).

Method Summary
`C` `asOCLType(C modelType)` Obtains the OCL type corresponding to the specified type from the environment's type system.
`COA` `createCallOperationAction(O operation)` Creates a `CallOperationAction` referencing the specified operation.
`CT` `createConstraint()` Creates a `Constraint`.
`ExpressionInOCL<C,PM>` `createExpressionInOCL()` Creates an `ExpressionInOCL`.
`O` `createOperation(String name, C resultType, List<String> paramNames, List<C> paramTypes)` Creates a new `Operation`.
`P` `createProperty(String name, C resultType)` Creates a new `Property`.
`SSA` `createSendSignalAction(C signal)` Creates a `SendSignalAction` referencing the specified signal.
`Collection<? extends C>` `getAllSupertypes(C classifier)` Obtains all of the classifiers that generalize the specified classifier.
`C` `getAssociationClass(P property)` Obtains the association class of which the specified `property` is an end, if any.
`List<P>` `getAttributes(C classifier)` Obtains all of the attributes defined by and inherited by the specified classifier.
`List<C>` `getClassifiers(PK pkg)` Obtains the classifiers contained directly within the specified package.
`C` `getCommonSuperType(C type1, C type2)` Obtains the least common general classifier of two classifiers, if they have any in common.
`List<EObject>` `getConstrainedElements(CT constraint)` Obtains the list of element constraint by a constraint, as a list of `EObject`s.
`CT` `getConstraint(ExpressionInOCL<C,PM> specification)` Obtains the constraint owning the given specification, if any.
`String` `getConstraintName(CT constraint)` Obtains the name of a constraint.
`String` `getDescription(Object namedElement)` Obtains the user-presentable description of an element.
`C` `getEnumeration(EL enumerationLiteral)` Obtains the enumeration declaring the specified literal.
`EL` `getEnumerationLiteral(C enumerationType, String literalName)` Obtains the named literal of an enumeration.
`List<EL>` `getEnumerationLiterals(C enumerationType)` Obtains the literals declared by the specified enumeration type.
`List<P>` `getMemberEnds(C associationClass)` Obtains the ends of the specified association class as a list of properties.
`String` `getName(Object namedElement)` Obtains the name of an element, if it is a named element.
`List<PK>` `getNestedPackages(PK pkg)` Obtains the packages nested within the specified nesting package, if any.
`PK` `getNestingPackage(PK pkg)` Obtains the parent package (or nearest parent package), if any, of the specified package.
`C` `getOCLType(Object metaElement)` Obtains the type of a meta-element (classifier, operation, property, parameter, etc.).
`O` `getOperation(COA callOperationAction)` Obtains the called operation referenced by the specified call action.
`List<O>` `getOperations(C classifier)` Obtains all of the operations defined by and inherited by the specified classifier.
`C` `getOwningClassifier(Object feature)` Obtains the classifier that declares the specified feature.
`PK` `getPackage(C classifier)` Obtains the package containing (or nearest package of) the specified classifier.
`List<PM>` `getParameters(O operation)` Obtains the formal parameters (excluding return parameters) of an operation.
`String` `getQualifiedName(Object namedElement)` Obtains the qualified name of an element ("::"-separated), if it is a named element.
`List<P>` `getQualifiers(P property)` Gets the qualifiers of a property representing a UML association end.
`int` `getRelationship(C type1, C type2)` Obtains the relationship (according to generalization) between two classifiers in the user model.
`C` `getSignal(SSA sendSignalAction)` Obtains the sent signal referenced by the specified send action.
`List<C>` `getSignals(C owner)` Retrieves a list of all signal receptions defined by the specified `owner` classifier.
`ExpressionInOCL<C,PM>` `getSpecification(CT constraint)` Obtains the specification of a constraint, if it is an `ExpressionInOCL`.
`String` `getStereotype(CT constraint)` Obtains the stereotype (one of the constants defined by this interface) that identifies the kind of the specified constraint.
`Object` `getStereotypeApplication(Object baseElement, C stereotype)` Obtains the application (stereotype instance) of the specified stereotype applied to the given base element, if the stereotype is indeed applied.
`boolean` `isAssociationClass(C type)` Determines whether the specified `type` is an association class.
`boolean` `isClass(Object metaElement)` Queries whether the specified model element is a class.
`boolean` `isClassifier(Object metaElement)` Queries whether the specified model element is a classifier.
`boolean` `isComparable(C type)` Queries whether the specified type is a comparable (fully ordered) data type.
`boolean` `isDataType(Object metaElement)` Queries whether the specified model element is a data type.
`boolean` `isEnumeration(C type)` Queries whether the specified classifier is an enumeration.
`boolean` `isMany(Object metaElement)` Queries whether the specified meta-element (already known to be a property, parameter, or operation) has multiplicity many.
`boolean` `isOperation(Object metaElement)` Queries whether the specified model element is an operation.
`boolean` `isProperty(Object metaElement)` Queries whether the specified model element is a property.
`boolean` `isQuery(O operation)` Determines whether the specified `operation` is a query operation.
`boolean` `isStatic(Object feature)` Queries whether a property or operation is static (applies to a classifier rather than to its instances).
`boolean` `isStereotype(C type)` Queries whether the specified model element is a stereotype.
`void` `setConstraintName(CT constraint, String name)` Sets the name of a constraint.
`void` `setName(TypedElement<C> element, String name)` Sets the name of the specified typed element.
`void` `setSpecification(CT constraint, ExpressionInOCL<C,PM> specification)` Sets the specification of a constraint.
`void` `setStereotype(CT constraint, String stereotype)` Sets the stereotype (one of the constants defined by this interface) that identifies the kind of the specified constraint.
`void` `setType(TypedElement<C> element, C type)` Sets the type of the specified typed element.

Field Detail

### INVARIANT

    static final String INVARIANT

  Stereotype applied to classifier invariant constraints.

  See Also:
    `getStereotype(CT)`, Constant Field Values

### PRECONDITION

    static final String PRECONDITION

  Stereotype applied to operation precondition constraints.

  See Also:
    `getStereotype(CT)`, Constant Field Values

### POSTCONDITION

    static final String POSTCONDITION

  Stereotype applied to operation postcondition constraints.

  See Also:
    `getStereotype(CT)`, Constant Field Values

### BODY

    static final String BODY

  Stereotype applied to operation body conditions.

  See Also:
    `getStereotype(CT)`, Constant Field Values

### DEFINITION

    static final String DEFINITION

  Stereotype applied definition expressions.

  See Also:
    `getStereotype(CT)`, Constant Field Values

### INITIAL

    static final String INITIAL

  Stereotype applied initial value expressions.

  See Also:
    `getStereotype(CT)`, Constant Field Values

### DERIVATION

    static final String DERIVATION

  Stereotype applied derived value expressions.

  See Also:
    `getStereotype(CT)`, Constant Field Values

### OCL_HELPER

    static final String OCL_HELPER

  Stereotype applied to herlp attributes and operations defined by definition constraints.

  See Also:
    Constant Field Values

### SAME_TYPE

    static final int SAME_TYPE

  Result of `getRelationship(C, C)` indicating that two classifiers are, in fact, the same type.

  See Also:
    Constant Field Values

### STRICT_SUBTYPE

    static final int STRICT_SUBTYPE

  Result of `getRelationship(C, C)` indicating that the first classifier is a strict subtype of the second.

  See Also:
    Constant Field Values

### SUBTYPE

    static final int SUBTYPE

  Mask for testing the result of the `getRelationship(C, C)` method, to check whether the first classifier is the same type as or a strict subtype of the second.

  See Also:
    Constant Field Values

### STRICT_SUPERTYPE

    static final int STRICT_SUPERTYPE

  Result of `getRelationship(C, C)` indicating that the first classifier is a strict supertype of the second.

  See Also:
    Constant Field Values

### SUPERTYPE

    static final int SUPERTYPE

  Mask for testing the result of the `getRelationship(C, C)` method, to check whether the first classifier is the same type as or a strict supertype of the second.

  See Also:
    Constant Field Values

### RELATED_TYPE

    static final int RELATED_TYPE

  Mask for testing the result of the `getRelationship(C, C)` method, to check whether the first classifier is related by generalization to the second classifier (being either a supertype or a subtype of it, including possibly the same type).

  See Also:
    Constant Field Values

### UNRELATED_TYPE

    static final int UNRELATED_TYPE

  Result of `getRelationship(C, C)` indicating that the first classifier is not related by generalization to the second classifier (being different from it and neither a subtype nor a supertype).

  See Also:
    Constant Field Values

Method Detail

### getOCLType

    C getOCLType(Object metaElement)

  Obtains the type of a meta-element (classifier, operation, property, parameter, etc.). If there is a predefined type provided by OCL (such as Boolean or Set), then it should be returned. For elements that have multiplicity (properties, parameters, operations), the type that is returned should be an OCL collection type if the element has many multiplicity.

  Parameters:
    `metaElement` - an element of the environment's metamodel
  Returns:
    its OCL type
  See Also:
    `isMany(Object)`

### getAllSupertypes

    Collection<? extends C> getAllSupertypes(C classifier)

  Obtains all of the classifiers that generalize the specified classifier.

  Parameters:
    `classifier` - a classifier
  Returns:
    all of its general classifiers, or an empty collection if none

### isMany

    boolean isMany(Object metaElement)

  Queries whether the specified meta-element (already known to be a property, parameter, or operation) has multiplicity many.

  Parameters:
    `metaElement` - a property, parameter, or operation
  Returns:
    whether it has many multiplicity

### asOCLType

    C asOCLType(C modelType)

  Obtains the OCL type corresponding to the specified type from the environment's type system. If there is a predefined type provided by OCL (such as Boolean), then it should be returned. Otherwise, the environment's own type (the original `modelType`) is appropriate.

  Parameters:
    `modelType` - a type in the environment
  Returns:
    the corresponding OCL pre-defined type, or just `modelType` if none

### getNestingPackage

    PK getNestingPackage(PK pkg)

  Obtains the parent package (or nearest parent package), if any, of the specified package.

  Parameters:
    `pkg` - a package
  Returns:
    the nearest nesting package, or `null` if the given package has no nesting package
  See Also:
    `getNestedPackages(PK)`

### getNestedPackages

    List<PK> getNestedPackages(PK pkg)

  Obtains the packages nested within the specified nesting package, if any.

  Parameters:
    `pkg` - a package
  Returns:
    the nested packages, or an empty list if none
  See Also:
    `getNestingPackage(PK)`

### getPackage

    PK getPackage(C classifier)

  Obtains the package containing (or nearest package of) the specified classifier.

  Parameters:
    `classifier` - a classifier in the model
  Returns:
    the nearest containing package, or `null` if there is none

### getClassifiers

    List<C> getClassifiers(PK pkg)

  Obtains the classifiers contained directly within the specified package.

  Parameters:
    `pkg` - a package in the model
  Returns:
    the classifiers in the package, or an empty list if none

### getOwningClassifier

    C getOwningClassifier(Object feature)

  Obtains the classifier that declares the specified feature.

  Parameters:
    `feature` - an operation or property
  Returns:
    the classifier that defines the specified feature (should never be `null`)

### getSignals

    List<C> getSignals(C owner)

  Retrieves a list of all signal receptions defined by the specified `owner` classifier. This must include also signals defined by supertypes of the owner. This method is used for content-assist.

  Parameters:
    `owner` - the owner type of the signal receptions
  Returns:
    the available signals (as `EClass`es), or an empty list if none

### createOperation

    O createOperation(String name,
                      C resultType,
                      List<String> paramNames,
                      List<C> paramTypes)

  Creates a new `Operation`. Because OCL can only define query operations, a result type must be provided. This method is used in parsing the definition of additional operations, and in the construction of the OCL standard library types.

  Note that the new operation must be a query operation, as OCL can only define queries.

  Parameters:
    `name` - the name of the new operation (must not be `null`)
    `resultType` - the result type of the operation (not `null`)
    `paramNames` - the names of the formal parameters of the operaiton (may be an empty list if no parameters)
    `paramTypes` - the parameter types, corresponding one-for-one with the parameter names
  Returns:
    the new operation
  See Also:
    `isQuery(Object)`

### getParameters

    List<PM> getParameters(O operation)

  Obtains the formal parameters (excluding return parameters) of an operation.

  Parameters:
    `operation` - an operation in the model
  Returns:
    the operation's formal parameters, or an empty list if none

### getOperations

    List<O> getOperations(C classifier)

  Obtains all of the operations defined by and inherited by the specified classifier. This method will not be called for the types pre-defined by OCL, as their operations are known by the parser.

  Parameters:
    `classifier` - a classifier in the model
  Returns:
    the operations applicable to the specified classifier, or an empty list if none

### createProperty

    P createProperty(String name,
                     C resultType)

  Creates a new `Property`. A type must be provided. This method is used in parsing the definition of additional properties, and in the construction of the OCL standard library types.

  Parameters:
    `name` - the name of the new property (must not be `null`)
    `resultType` - the type of the property (not `null`)
  Returns:
    the new property

### getAttributes

    List<P> getAttributes(C classifier)

  Obtains all of the attributes defined by and inherited by the specified classifier. This method will not be called for the types pre-defined by OCL (such as tuple and message types), as their attributes are known by the parser.

  Parameters:
    `classifier` - a classifier in the model
  Returns:
    the attributes applicable to the specified classifier, or an empty list if none

### isQuery

    boolean isQuery(O operation)

  Determines whether the specified `operation` is a query operation. Query operations are guaranteed not to alter the system; by the nature of the OCL, all queries defined by OCL are queries.

  Parameters:
    `operation` - an operation
  Returns:
    whether it is a query operation

### isStatic

    boolean isStatic(Object feature)

  Queries whether a property or operation is static (applies to a classifier rather than to its instances).

  Parameters:
    `feature` - an operation or a property
  Returns:
    whether it is static

### getQualifiers

    List<P> getQualifiers(P property)

  Gets the qualifiers of a property representing a UML association end.

  Parameters:
    `property` - a property of the model class
  Returns:
    the qualifiers (as a list of properties), or an empty list if the property has no qualifiers

### isAssociationClass

    boolean isAssociationClass(C type)

  Determines whether the specified `type` is an association class.

  Parameters:
    `type` - a classifier in the model
  Returns:
    whether it is an association class

### getAssociationClass

    C getAssociationClass(P property)

  Obtains the association class of which the specified `property` is an end, if any.

  Parameters:
    `property` - a property
  Returns:
    the association class, or `null` if the property is not an end of an association class

### getMemberEnds

    List<P> getMemberEnds(C associationClass)

  Obtains the ends of the specified association class as a list of properties. This association class was already determined to be such by the `isAssociationClass(C)` method.

  Parameters:
    `associationClass` - a classifier representing an association class
  Returns:
    the properties representing its member ends (the association roles)
  See Also:
    `isAssociationClass(C)`

### isOperation

    boolean isOperation(Object metaElement)

  Queries whether the specified model element is an operation.

  Parameters:
    `metaElement` - a model element
  Returns:
    whether it is an operation

### isProperty

    boolean isProperty(Object metaElement)

  Queries whether the specified model element is a property.

  Parameters:
    `metaElement` - a model element
  Returns:
    whether it is a property

### isClassifier

    boolean isClassifier(Object metaElement)

  Queries whether the specified model element is a classifier.

  Parameters:
    `metaElement` - a model element
  Returns:
    whether it is a classifier

### isClass

    boolean isClass(Object metaElement)

  Queries whether the specified model element is a class.

  Parameters:
    `metaElement` - a model element
  Returns:
    whether it is a class

### isDataType

    boolean isDataType(Object metaElement)

  Queries whether the specified model element is a data type.

  Parameters:
    `metaElement` - a model element
  Returns:
    whether it is a data type

### isStereotype

    boolean isStereotype(C type)

  Queries whether the specified model element is a stereotype. Note that a metamodel is not required to support stereotypes.

  Parameters:
    `type` - a type in the model
  Returns:
    whether it is a stereotype

### getStereotypeApplication

    Object getStereotypeApplication(Object baseElement,
                                    C stereotype)

  Obtains the application (stereotype instance) of the specified stereotype applied to the given base element, if the stereotype is indeed applied.

  Parameters:
    `baseElement` - a model element
    `stereotype` - a stereotype applied to the element
  Returns:
    the stereotype instance if the stereotype is applied to it, or `null` if the stereotype is not applied

### isEnumeration

    boolean isEnumeration(C type)

  Queries whether the specified classifier is an enumeration.

  Parameters:
    `type` - a type in the model
  Returns:
    whether it is an enumeration

### getEnumeration

    C getEnumeration(EL enumerationLiteral)

  Obtains the enumeration declaring the specified literal.

  Parameters:
    `enumerationLiteral` - an enumeration literal
  Returns:
    the literal's declaring enumeration (should not be `null`)

### getEnumerationLiterals

    List<EL> getEnumerationLiterals(C enumerationType)

  Obtains the literals declared by the specified enumeration type. This type was already determined to be an `enumeration`.

  Parameters:
    `enumerationType` - an enumeration
  Returns:
    its literals, or an empty set if it has none

### getEnumerationLiteral

    EL getEnumerationLiteral(C enumerationType,
                             String literalName)

  Obtains the named literal of an enumeration. This type was already determined to be an `enumeration`.

  Parameters:
    `enumerationType` - an enumeration
    `literalName` - the name of a literal
  Returns:
    the matching enumeration literal, or `null` if the specified name does not match an existing literal

### isComparable

    boolean isComparable(C type)

  Queries whether the specified type is a comparable (fully ordered) data type. Instances of a comparable type can be compared using the <, <=, >, and >= operations.

  Parameters:
    `type` - a type in the model
  Returns:
    whether it is comparable

### createCallOperationAction

    COA createCallOperationAction(O operation)

  Creates a `CallOperationAction` referencing the specified operation.

  Parameters:
    `operation` - the operation that is called
  Returns:
    the `CallOperationAction`

### getOperation

    O getOperation(COA callOperationAction)

  Obtains the called operation referenced by the specified call action.

  Parameters:
    `callOperationAction` - an operation-call action
  Returns:
    the called operation (should not be `null`)

### createSendSignalAction

    SSA createSendSignalAction(C signal)

  Creates a `SendSignalAction` referencing the specified signal.

  Parameters:
    `signal` - the signal that is send
  Returns:
    the `SendSignalAction`

### getSignal

    C getSignal(SSA sendSignalAction)

  Obtains the sent signal referenced by the specified send action.

  Parameters:
    `sendSignalAction` - a signal-send action
  Returns:
    the sent signal (should not be `null`)

### createConstraint

    CT createConstraint()

  Creates a `Constraint`.

  Returns:
    the new `Constraint`

### getStereotype

    String getStereotype(CT constraint)

  Obtains the stereotype (one of the constants defined by this interface) that identifies the kind of the specified constraint.

  Parameters:
    `constraint` - a constraint
  Returns:
    its stereotype (should not be `null`)

### setStereotype

    void setStereotype(CT constraint,
                       String stereotype)

  Sets the stereotype (one of the constants defined by this interface) that identifies the kind of the specified constraint.

  Parameters:
    `constraint` - a constraint
    `stereotype` - its stereotype (must not be `null`)

### getConstraintName

    String getConstraintName(CT constraint)

  Obtains the name of a constraint.

  Parameters:
    `constraint` - a constraint
  Returns:
    the constraint name

### setConstraintName

    void setConstraintName(CT constraint,
                           String name)

  Sets the name of a constraint.

  Parameters:
    `constraint` - a constraint
    `name` - the constraint name

### createExpressionInOCL

    ExpressionInOCL<C,PM> createExpressionInOCL()

  Creates an `ExpressionInOCL`.

  Returns:
    the new `ExpressionInOCL`

### getSpecification

    ExpressionInOCL<C,PM> getSpecification(CT constraint)

  Obtains the specification of a constraint, if it is an `ExpressionInOCL`.

  Parameters:
    `constraint` - a constraint
  Returns:
    its specification as an `ExpressionInOCL`, or `null` if it has none or it is not an `ExpressionInOCL`

### setSpecification

    void setSpecification(CT constraint,
                          ExpressionInOCL<C,PM> specification)

  Sets the specification of a constraint.

  Parameters:
    `constraint` - a constraint
    `specification` - its specification

### getConstraint

    CT getConstraint(ExpressionInOCL<C,PM> specification)

  Obtains the constraint owning the given specification, if any.

  Parameters:
    `specification` - a constraint specification
  Returns:
    the constraint that it specifies, or `null` if none

### getConstrainedElements

    List<EObject> getConstrainedElements(CT constraint)

  Obtains the list of element constraint by a constraint, as a list of `EObject`s. This list is modifiable.

  Parameters:
    `constraint` - a constraint
  Returns:
    its constrained elements

### getName

    String getName(Object namedElement)

  Obtains the name of an element, if it is a named element.

  Parameters:
    `namedElement` - a named element
  Returns:
    the named element's name, or `null` if it is not a named element

### getQualifiedName

    String getQualifiedName(Object namedElement)

  Obtains the qualified name of an element ("::"-separated), if it is a named element.

  Parameters:
    `namedElement` - a named element
  Returns:
    the named element's qualified name, or `null` if it is not a named element

### getDescription

    String getDescription(Object namedElement)

  Obtains the user-presentable description of an element. For typed elements, this should be the type name and for enumeration literals, the enumeration name. For other elements, it should be the name (optionally localized) of the metaclass of the element. This description is used in the presentation of content-assist `Choice`s.

  Parameters:
    `namedElement` - a named element
  Returns:
    the named element's description

### getCommonSuperType

    C getCommonSuperType(C type1,
                         C type2)

  Obtains the least common general classifier of two classifiers, if they have any in common.

  Parameters:
    `type1` - a classifier in the model
    `type2` - another classifier in the model
  Returns:
    the least common supertype, or `null` if none. This result (if any) must be a type in the user model; an implementation must not return `OclAny` in the case that there is no common supertype

### getRelationship

    int getRelationship(C type1,
                        C type2)

  Obtains the relationship (according to generalization) between two classifiers in the user model.

  Parameters:
    `type1` - a classifier in the model
    `type2` - another classifier in the model
  Returns:
    one of the relationship constants defined by this class

### setName

    void setName(TypedElement<C> element,
                 String name)

  Sets the name of the specified typed element.

  Parameters:
    `element` - a typed element
    `name` - the type element's name
  See Also:
    `TypedElement.getName()`

### setType

    void setType(TypedElement<C> element,
                 C type)

  Sets the type of the specified typed element.

  Parameters:
    `element` - a typed element
    `type` - the type element's type
  See Also:
    `TypedElement.getType()`

Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved.