public class UMLReflectionImpl extends Object implements UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>
BODY, DEFINITION, DERIVATION, INITIAL, INVARIANT, OCL_HELPER, POSTCONDITION, PRECONDITION, RELATED_TYPE, SAME_TYPE, STRICT_SUBTYPE, STRICT_SUPERTYPE, SUBTYPE, SUPERTYPE, UNRELATED_TYPE| Constructor and Description |
|---|
UMLReflectionImpl(UMLEnvironment env) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConstrainedElement(Constraint constraint,
EObject constrainedElement)
Adds a constrainedElement to a constraint.
|
Classifier |
asOCLType(Classifier modelType)
Obtains the OCL type corresponding to the specified type from the
environment's type system.
|
CallOperationAction |
createCallOperationAction(Operation operation)
Creates a CallOperationAction referencing the specified
operation.
|
Constraint |
createConstraint()
Creates a Constraint.
|
ExpressionInOCL<Classifier,Parameter> |
createExpressionInOCL()
Creates an ExpressionInOCL.
|
Operation |
createOperation(String name,
Classifier resultType,
List<String> paramNames,
List<Classifier> paramTypes)
Creates a new Operation.
|
Property |
createProperty(String name,
Classifier resultType)
Creates a new Property.
|
SendSignalAction |
createSendSignalAction(Classifier signal)
Creates a SendSignalAction referencing the specified
signal.
|
Collection<? extends Classifier> |
getAllSupertypes(Classifier classifier)
Obtains all of the classifiers that generalize the specified classifier.
|
Classifier |
getAssociationClass(Property property)
Obtains the association class of which the specified property
is an end, if any.
|
List<Property> |
getAttributes(Classifier classifier)
Obtains all of the attributes defined by and inherited by the specified
classifier.
|
List<Classifier> |
getClassifiers(Package pkg)
Obtains the classifiers contained directly within the specified package.
|
Classifier |
getCommonSuperType(Classifier type1,
Classifier type2)
Obtains the least common general classifier of two classifiers, if they
have any in common.
|
List<Element> |
getConstrainedElements(Constraint constraint)
Obtains the list of element constraint by a constraint, as a list of
EObjects. |
Constraint |
getConstraint(ExpressionInOCL<Classifier,Parameter> specification)
Obtains the constraint owning the given specification, if any.
|
String |
getConstraintName(Constraint constraint)
Obtains the name of a constraint.
|
String |
getDescription(Object namedElement)
Default implementation just gets the name of the named element's
metaclass or, if it is a
TypedElement, the name of its type. |
Classifier |
getEnumeration(EnumerationLiteral enumerationLiteral)
Obtains the enumeration declaring the specified literal.
|
EnumerationLiteral |
getEnumerationLiteral(Classifier enumerationType,
String literalName)
Obtains the named literal of an enumeration.
|
List<EnumerationLiteral> |
getEnumerationLiterals(Classifier enumerationType)
Obtains the literals declared by the specified enumeration type.
|
List<Property> |
getMemberEnds(Classifier 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<Package> |
getNestedPackages(Package pkg)
Obtains the packages nested within the specified nesting package, if
any.
|
Package |
getNestingPackage(Package pkg)
Obtains the parent package (or nearest parent package), if any, of the
specified package.
|
Classifier |
getOCLType(Object metaElement)
Obtains the type of a meta-element (classifier, operation, property,
parameter, etc.).
|
Operation |
getOperation(CallOperationAction callOperationAction)
Obtains the called operation referenced by the specified call action.
|
List<Operation> |
getOperations(Classifier classifier)
Obtains all of the operations defined by and inherited by the specified
classifier.
|
Classifier |
getOwningClassifier(Object feature)
Obtains the classifier that declares the specified feature.
|
Package |
getPackage(Classifier classifier)
Obtains the package containing (or nearest package of) the specified
classifier.
|
List<Parameter> |
getParameters(Operation 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<Property> |
getQualifiers(Property property)
Gets the qualifiers of a property representing a UML association end.
|
int |
getRelationship(Classifier type1,
Classifier type2)
Obtains the relationship (according to generalization) between two
classifiers in the user model.
|
Classifier |
getSignal(SendSignalAction sendSignalAction)
Obtains the sent signal referenced by the specified send action.
|
List<Classifier> |
getSignals(Classifier owner)
Retrieves a list of all signal receptions defined by the specified
owner classifier. |
ExpressionInOCL<Classifier,Parameter> |
getSpecification(Constraint constraint)
Obtains the specification of a constraint, if it is an
ExpressionInOCL.
|
String |
getStereotype(Constraint constraint)
Obtains the stereotype (one of the constants defined by this interface)
that identifies the kind of the specified constraint.
|
Object |
getStereotypeApplication(Object baseElement,
Classifier stereotype)
Obtains the application (stereotype instance) of the specified stereotype
applied to the given base element, if the stereotype is indeed applied.
|
boolean |
isAssociationClass(Classifier classifier)
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(Classifier type)
Queries whether the specified type is a comparable (fully ordered)
data type.
|
boolean |
isConstraint(Object metaElement)
Queries whether the specified model element is a constraint.
|
boolean |
isDataType(Object metaElement)
Queries whether the specified model element is a data type.
|
boolean |
isEnumeration(Classifier 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 |
isPackage(Object metaElement)
Queries whether the specified model element is a package.
|
boolean |
isProperty(Object metaElement)
Queries whether the specified model element is a property.
|
boolean |
isQuery(Operation 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(Classifier type)
Queries whether the specified model element is a stereotype.
|
void |
setConstraintName(Constraint constraint,
String name)
Sets the name of a constraint.
|
boolean |
setIsStatic(Object feature,
boolean isStatic)
Sets a property or operation static (applies to a classifier
rather than to its instances).
|
void |
setName(TypedElement<Classifier> element,
String name)
Sets the name of the specified typed element.
|
void |
setSpecification(Constraint constraint,
ExpressionInOCL<Classifier,Parameter> specification)
Sets the specification of a constraint.
|
void |
setStereotype(Constraint 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<Classifier> element,
Classifier type)
Sets the type of the specified typed element.
|
public UMLReflectionImpl(UMLEnvironment env)
public String getDescription(Object namedElement)
metaclass or, if it is a
TypedElement, the name of its type.getDescription in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>namedElement - a named elementpublic String getName(Object namedElement)
UMLReflectiongetName in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>namedElement - a named elementnull if it is not
a named elementpublic String getQualifiedName(Object namedElement)
UMLReflectiongetQualifiedName in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>namedElement - a named elementnull if
it is not a named elementpublic Classifier getOCLType(Object metaElement)
UMLReflectiongetOCLType in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>metaElement - an element of the environment's metamodelUMLReflection.isMany(Object)public boolean isMany(Object metaElement)
UMLReflectionisMany in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>metaElement - a property, parameter, or operationpublic Classifier asOCLType(Classifier modelType)
UMLReflectionasOCLType in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>modelType - a type in the environmentpublic Package getNestingPackage(Package pkg)
UMLReflectiongetNestingPackage in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>pkg - a packagenull if the given
package has no nesting packageUMLReflection.getNestedPackages(PK)public List<Package> getNestedPackages(Package pkg)
UMLReflectiongetNestedPackages in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>pkg - a packageUMLReflection.getNestingPackage(PK)public Package getPackage(Classifier classifier)
UMLReflectiongetPackage in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>classifier - a classifier in the modelnull if there
is nonepublic List<Classifier> getClassifiers(Package pkg)
UMLReflectiongetClassifiers in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>pkg - a package in the modelpublic Classifier getOwningClassifier(Object feature)
UMLReflectiongetOwningClassifier in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>feature - an operation or propertynull)public List<Parameter> getParameters(Operation operation)
UMLReflectiongetParameters in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>operation - an operation in the modelpublic Operation createOperation(String name, Classifier resultType, List<String> paramNames, List<Classifier> paramTypes)
UMLReflectionNote that the new operation must be a query operation, as OCL can only define queries.
createOperation in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>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 namesUMLReflection.isQuery(Object)public List<Operation> getOperations(Classifier classifier)
UMLReflectiongetOperations in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>classifier - a classifier in the modelpublic Property createProperty(String name, Classifier resultType)
UMLReflectioncreateProperty in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>name - the name of the new property (must not be null)resultType - the type of the property (not null)public List<Property> getAttributes(Classifier classifier)
UMLReflectiongetAttributes in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>classifier - a classifier in the modelpublic Collection<? extends Classifier> getAllSupertypes(Classifier classifier)
UMLReflectiongetAllSupertypes in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>classifier - a classifierpublic boolean isQuery(Operation operation)
UMLReflectionoperation 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.isQuery in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>operation - an operationpublic boolean isStatic(Object feature)
UMLReflectionisStatic in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>feature - an operation or a propertypublic boolean setIsStatic(Object feature, boolean isStatic)
UMLReflectionsetIsStatic in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>feature - an operation or a propertyisStatic - whether it is to be staticpublic boolean isAssociationClass(Classifier classifier)
UMLReflectiontype is an association
class.isAssociationClass in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>classifier - a classifier in the modelpublic Classifier getAssociationClass(Property property)
UMLReflectiongetAssociationClass in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>property - a propertynull if the property
is not an end of an association classpublic List<Property> getMemberEnds(Classifier associationClass)
UMLReflectionUMLReflection.isAssociationClass(C) method.getMemberEnds in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>associationClass - a classifier representing an association classUMLReflection.isAssociationClass(C)public boolean isOperation(Object metaElement)
UMLReflectionisOperation in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>metaElement - a model elementpublic boolean isPackage(Object metaElement)
UMLReflectionisPackage in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>metaElement - a model elementpublic boolean isProperty(Object metaElement)
UMLReflectionisProperty in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>metaElement - a model elementpublic boolean isClassifier(Object metaElement)
UMLReflectionisClassifier in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>metaElement - a model elementpublic boolean isClass(Object metaElement)
UMLReflectionisClass in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>metaElement - a model elementpublic boolean isConstraint(Object metaElement)
UMLReflectionisConstraint in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>metaElement - a model elementpublic boolean isDataType(Object metaElement)
UMLReflectionisDataType in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>metaElement - a model elementpublic boolean isStereotype(Classifier type)
UMLReflectionisStereotype in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>type - a type in the modelpublic Object getStereotypeApplication(Object baseElement, Classifier stereotype)
UMLReflectiongetStereotypeApplication in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>baseElement - a model elementstereotype - a stereotype applied to the elementnull if the stereotype is not appliedpublic boolean isEnumeration(Classifier type)
UMLReflectionisEnumeration in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>type - a type in the modelpublic Classifier getEnumeration(EnumerationLiteral enumerationLiteral)
UMLReflectiongetEnumeration in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>enumerationLiteral - an enumeration literalnull)public List<EnumerationLiteral> getEnumerationLiterals(Classifier enumerationType)
UMLReflectionenumeration.getEnumerationLiterals in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>enumerationType - an enumerationpublic EnumerationLiteral getEnumerationLiteral(Classifier enumerationType,
String literalName)
UMLReflectionenumeration.getEnumerationLiteral in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>enumerationType - an enumerationliteralName - the name of a literalnull if the
specified name does not match an existing literalpublic boolean isComparable(Classifier type)
UMLReflectionisComparable in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>type - a type in the modelpublic Operation getOperation(CallOperationAction callOperationAction)
UMLReflectiongetOperation in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>callOperationAction - an operation-call actionnull)public Classifier getSignal(SendSignalAction sendSignalAction)
UMLReflectiongetSignal in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>sendSignalAction - a signal-send actionnull)public String getStereotype(Constraint constraint)
UMLReflectiongetStereotype in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>constraint - a constraintnull)public void setStereotype(Constraint constraint,
String stereotype)
UMLReflectionsetStereotype in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>constraint - a constraintstereotype - its stereotype (must not be null)public String getConstraintName(Constraint constraint)
UMLReflectiongetConstraintName in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>constraint - a constraintpublic void setConstraintName(Constraint constraint,
String name)
UMLReflectionsetConstraintName in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>constraint - a constraintname - the constraint namepublic ExpressionInOCL<Classifier,Parameter> getSpecification(Constraint constraint)
UMLReflectiongetSpecification in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>constraint - a constraintnull
if it has none or it is not an ExpressionInOCLpublic void setSpecification(Constraint constraint,
ExpressionInOCL<Classifier,Parameter> specification)
UMLReflectionsetSpecification in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>constraint - a constraintspecification - its specificationpublic Constraint getConstraint(ExpressionInOCL<Classifier,Parameter> specification)
UMLReflectiongetConstraint in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>specification - a constraint specificationnull if nonepublic List<Element> getConstrainedElements(Constraint constraint)
UMLReflectionEObjects. This list is modifiable, but only after an unsafe cast to
establish a lower type bound. Therefore the UMLReflection.addConstrainedElement(CT, EObject) method
should be used instead.getConstrainedElements in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>constraint - a constraintpublic void addConstrainedElement(Constraint constraint,
EObject constrainedElement)
UMLReflectionaddConstrainedElement in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>constraint - the constraint to receiveconstrainedElement - the constrained elementpublic List<Property> getQualifiers(Property property)
UMLReflectiongetQualifiers in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>property - a property of the model classpublic Classifier getCommonSuperType(Classifier type1,
Classifier type2)
UMLReflectiongetCommonSuperType in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>type1 - a classifier in the modeltype2 - another classifier in the modelnull 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 supertypepublic int getRelationship(Classifier type1,
Classifier type2)
UMLReflectiongetRelationship in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>type1 - a classifier in the modeltype2 - another classifier in the modelpublic List<Classifier> getSignals(Classifier owner)
UMLReflectionowner classifier. This must include also signals
defined by supertypes of the owner. This method is used for content-assist.getSignals in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>owner - the owner type of the signal receptionsEClasses), or an empty list if nonepublic CallOperationAction createCallOperationAction(Operation operation)
UMLReflectioncreateCallOperationAction in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>operation - the operation that is calledpublic SendSignalAction createSendSignalAction(Classifier signal)
UMLReflectioncreateSendSignalAction in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>signal - the signal that is sendpublic Constraint createConstraint()
UMLReflectioncreateConstraint in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>public ExpressionInOCL<Classifier,Parameter> createExpressionInOCL()
UMLReflectioncreateExpressionInOCL in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>public void setName(TypedElement<Classifier> element, String name)
UMLReflectionsetName in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>element - a typed elementname - the type element's nameTypedElement.getName()public void setType(TypedElement<Classifier> element, Classifier type)
UMLReflectionsetType in interface UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint>element - a typed elementtype - the type element's typeTypedElement.getType()Copyright © 2005, 2018 IBM Corporation and others. All Rights Reserved.