T
- the result typepublic abstract class AbstractConstraintEvaluator<T>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected OCLExpression |
body |
protected ExpressionInOCL |
query |
Constructor and Description |
---|
AbstractConstraintEvaluator(ExpressionInOCL query)
Construct an helper for the evaluation of an expression
|
Modifier and Type | Method and Description |
---|---|
T |
evaluate(EvaluationVisitor evaluationVisitor)
Use the evaluationVisitor to execute my expression on the objects within the evaluationVisitor's evaluationEnvironment,
invoking one of handleSuccessResult, handleFailureResult, handleInvalidResult or handleExceptionResult to provide the return value.
|
static OCLExpression |
getConstraintExpression(ExpressionInOCL query)
Return the expression to be evaluated for a constraintSpecification, which is the constraintSpecification.bodyExpression
unless that is a status TuplePart PropertyCallExp in which case it is the source of the TuplePart PropertyCallExp enabling the
evaluation to compute the enriched Tuple of invariant results.
|
protected java.lang.String |
getConstraintName() |
protected java.lang.String |
getConstraintResultMessage(java.lang.Object result)
Return the message of result, which is null
unless result is a Tuple with a more informative severity part.
|
protected int |
getConstraintResultSeverity(java.lang.Object result)
Return the org.eclipse.emf.common.util.Diagnostic severity of result, which is ERROR
unless result is a Tuple with a more informative severity part.
|
protected boolean |
getConstraintResultStatus(java.lang.Object result)
Return true if result represents a successful constraint evaluation result.
|
protected java.lang.String |
getConstraintTypeName() |
protected abstract java.lang.String |
getObjectLabel()
Call-back to provide a description of the context object for use in a diagnostic.
|
protected abstract T |
handleExceptionResult(java.lang.Throwable e)
Call-back to return the appropriate response for an evaluation that was terminated by an exception.
|
protected abstract T |
handleFailureResult(java.lang.Object result)
Call-back to return the appropriate response for a failed evaluation.
|
protected abstract T |
handleInvalidExpression(java.lang.String message)
Call-back to return the appropriate response for an unsuccessful parse of the expression.
|
protected abstract T |
handleInvalidResult(InvalidValueException e)
Call-back to return the appropriate response for an unsuccessful evaluation with an invalid result.
|
protected abstract T |
handleSuccessResult()
Call-back to return the appropriate response for a successful evaluation.
|
protected boolean |
isBooleanConstraint()
Return true if the constraint has a Boolean result type.
|
@NonNull protected final ExpressionInOCL query
@NonNull protected final OCLExpression body
public AbstractConstraintEvaluator(@NonNull ExpressionInOCL query)
@NonNull public static OCLExpression getConstraintExpression(@NonNull ExpressionInOCL query)
public T evaluate(@NonNull EvaluationVisitor evaluationVisitor)
protected java.lang.String getConstraintName()
@NonNull protected java.lang.String getConstraintResultMessage(@Nullable java.lang.Object result)
protected int getConstraintResultSeverity(@Nullable java.lang.Object result)
protected boolean getConstraintResultStatus(@Nullable java.lang.Object result)
protected java.lang.String getConstraintTypeName()
protected abstract java.lang.String getObjectLabel()
protected abstract T handleExceptionResult(@NonNull java.lang.Throwable e)
protected abstract T handleFailureResult(@Nullable java.lang.Object result)
protected abstract T handleInvalidExpression(@NonNull java.lang.String message)
protected abstract T handleInvalidResult(@NonNull InvalidValueException e)
protected abstract T handleSuccessResult()
protected boolean isBooleanConstraint()