|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface OCLHelper
A utility object that provides OCL syntax completion suggestions for OCL expressions and convenient API for parsing OCL constraint expressions without the encumbrance of context declarations. The latter is most useful for processing OCL constraints and expressions embedded in the user model, where the context is implied by the placement of the constraint in the model.
An OCL helper is created by the OCL.createOCLHelper()
factory method
and inherits the current context Environment
of the OCL
that
created it.
Since 1.2, the helper supplies diagnostics indicating any problems encountered while parsing. The diagnostics pertain always to the most recently executed parse operation.
Note that this interface is not intended to be implemented by clients.
See the Environment
class for a description of the
generic type parameters of this class.
OCL.createOCLHelper()
Method Summary | |
---|---|
ExpressionInOCL |
createBodyCondition(java.lang.String expression)
Creates an operation body. |
ExpressionInOCL |
createDerivedValueExpression(java.lang.String expression)
Creates a property derived value expression. |
ExpressionInOCL |
createInvariant(java.lang.String expression)
Creates an invariant constraint in the current classifier context. |
ExpressionInOCL |
createPostcondition(java.lang.String expression)
Creates an operation postcondition constraint. |
ExpressionInOCL |
createPrecondition(java.lang.String expression)
Creates an operation precondition constraint. |
ExpressionInOCL |
createQuery(java.lang.String expression)
Creates a query expression in the current classifier context. |
Type |
getContextClassifier()
Obtains my OCL context classifier as a classifier. |
Operation |
getContextOperation()
Obtains my context operation, if my environment is an operation context. |
Property |
getContextProperty()
Obtains my context attribute, if my environment is an attribute context. |
Environment |
getEnvironment()
Obtains the environment defining my current classifier, operation, or attribute context. |
OCL |
getOCL()
Obtains the OCL instance that created me. |
org.eclipse.emf.common.util.Diagnostic |
getProblems()
Obtains problems, if any, found in parsing the last OCL constraint or query expression. |
boolean |
isValidating()
Queries whether I validate the expressions that I parse. |
void |
setContext(org.eclipse.emf.ecore.EClassifier context)
Sets the classifier context of the OCL expression for which syntax or parsing help is to be provided. |
void |
setContext(Type context)
Sets the classifier context of the OCL expression for which syntax or parsing help is to be provided. |
void |
setInstanceContext(java.lang.Object instance)
Sets the classifier context implied by the specified instance. |
void |
setInstanceOperationContext(java.lang.Object instance,
Operation operation)
Sets the operation context implied by the specified instance. |
void |
setInstancePropertyContext(java.lang.Object instance,
Property property)
Sets the operation context implied by the specified instance. |
void |
setOperationContext(org.eclipse.emf.ecore.EClassifier context,
org.eclipse.emf.ecore.EOperation operation)
Sets the operation context of the OCL expression for which syntax or parsing help is to be provided. |
void |
setOperationContext(Type context,
Operation operation)
Sets the operation context of the OCL expression for which syntax or parsing help is to be provided. |
void |
setPropertyContext(org.eclipse.emf.ecore.EClassifier context,
org.eclipse.emf.ecore.EStructuralFeature property)
Sets the attribute context of the OCL expression for which syntax or parsing help is to be provided. |
void |
setPropertyContext(Type context,
Property property)
Sets the attribute context of the OCL expression for which syntax or parsing help is to be provided. |
void |
setValidating(boolean validating)
Sets whether I should validate the expressions that I parse. |
Method Detail |
---|
void setContext(@NonNull org.eclipse.emf.ecore.EClassifier context)
context
- the OCL context classifier#setOperationContext(Object, Object)
,
#setPropertyContext(Object, Object)
void setContext(@NonNull Type context)
context
- the OCL context classifier#setOperationContext(Object, Object)
,
#setPropertyContext(Object, Object)
@Nullable Type getContextClassifier()
null
)void setOperationContext(@NonNull org.eclipse.emf.ecore.EClassifier context, @NonNull org.eclipse.emf.ecore.EOperation operation)
context
- the OCL context classifieroperation
- the OCL context operation#setContext(Object)
void setOperationContext(@NonNull Type context, @NonNull Operation operation)
context
- the OCL context classifieroperation
- the OCL context operation#setContext(Object)
@Nullable Operation getContextOperation()
null
if there is only a
classifier or attribute contextvoid setPropertyContext(@NonNull Type context, @NonNull Property property)
context
- the OCL context classifierproperty
- the OCL context attribute#setContext(Object)
void setPropertyContext(@NonNull org.eclipse.emf.ecore.EClassifier context, @NonNull org.eclipse.emf.ecore.EStructuralFeature property)
context
- the OCL context classifierproperty
- the OCL context attribute#setContext(Object)
@Nullable Property getContextProperty()
null
if there is only a
classifier or operation contextvoid setInstanceContext(@NonNull java.lang.Object instance)
This method is convenient for ad hoc parsing and evaluation of OCL constraints or expressions in the context of a model instance.
instance
- the OCL context instance#setContext(Object)
void setInstanceOperationContext(@NonNull java.lang.Object instance, @NonNull Operation operation)
This method is convenient for ad hoc parsing and evaluation of OCL constraints or expressions in the context of a model instance.
instance
- the OCL context instanceoperation
- the OCL context operation#setOperationContext(Object, Object)
void setInstancePropertyContext(@NonNull java.lang.Object instance, @NonNull Property property)
This method is convenient for ad hoc parsing and evaluation of OCL constraints or expressions in the context of a model instance.
instance
- the OCL context instanceproperty
- the OCL context attribute#setPropertyContext(Object, Object)
@NonNull OCL getOCL()
@NonNull Environment getEnvironment()
null
if I have
not yet been assigned a context#setContext(Object)
,
#setOperationContext(Object, Object)
,
#setPropertyContext(Object, Object)
boolean isValidating()
void setValidating(boolean validating)
validating
- whether I should validate parsed expressions@NonNull ExpressionInOCL createQuery(@NonNull java.lang.String expression) throws ParserException
expression
- the expression (without any context declaration).
This expression can have any result type; it needs not be a boolean
ParserException
- if the expression
fails to parse@NonNull ExpressionInOCL createInvariant(@NonNull java.lang.String expression) throws ParserException
expression
- the constraint expression (without any context
declaration). This must be a boolean-valued expression
ParserException
- if the expression
fails to parse@NonNull ExpressionInOCL createPrecondition(@NonNull java.lang.String expression) throws ParserException
expression
- the constraint expression (without any context
declaration). This must be a boolean-valued expression
ParserException
- if the expression
fails to parse#setOperationContext(Object, Object)
@NonNull ExpressionInOCL createPostcondition(@NonNull java.lang.String expression) throws ParserException
expression
- the constraint expression (without any context
declaration). This must be a boolean-valued expression
ParserException
- if the expression
fails to parse#setOperationContext(Object, Object)
@NonNull ExpressionInOCL createBodyCondition(@NonNull java.lang.String expression) throws ParserException
expression
- the constraint expression (without any context
declaration). Ordinarily, this is an expression of the same type
as the operation, specifying the value of the operation.
Alternatively, this may be a boolean-valued expression phrased like
a post-condition (according to the well-formedness rules of UML
constraints)
ParserException
- if the expression
fails to parse#setOperationContext(Object, Object)
@NonNull ExpressionInOCL createDerivedValueExpression(@NonNull java.lang.String expression) throws ParserException
expression
- the derived value expression (without any context
declaration). This must conform to my context property type
ParserException
- if the expression
fails to parse
or is not valid for my context property#setPropertyContext(Object, Object)
org.eclipse.emf.common.util.Diagnostic getProblems()
null
if all was OK
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |