org.eclipse.ocl.examples.pivot.delegate
Class OCLQueryDelegate
java.lang.Object
org.eclipse.ocl.examples.pivot.delegate.OCLQueryDelegate
- All Implemented Interfaces:
- org.eclipse.emf.ecore.util.QueryDelegate
public class OCLQueryDelegate
- extends java.lang.Object
- implements org.eclipse.emf.ecore.util.QueryDelegate
An implementation of a query delegate for OCL expressions.
- Since:
- 3.1
- See Also:
OCLQueryDelegateFactory
| Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.util.QueryDelegate |
org.eclipse.emf.ecore.util.QueryDelegate.Factory |
|
Method Summary |
java.lang.Object |
execute(java.lang.Object target,
java.util.Map<java.lang.String,?> arguments)
Executes the query for the specified target object. |
void |
prepare()
Prepares the query wrapping any exceptions as InvocationTargetException. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
delegateDomain
protected final OCLDelegateDomain delegateDomain
specification
protected final ExpressionInOcl specification
OCLQueryDelegate
public OCLQueryDelegate(OCLDelegateDomain delegateDomain,
ExpressionInOcl specification)
- Initializes me with my domain, context, variables, and expression.
- Parameters:
delegateDomain - my domaincontext - my contextvariables - name and types of variables used in my expressionexpression - the expression that I handle
- Throws:
ParserException - if the expression is invalid
prepare
public void prepare()
throws java.lang.reflect.InvocationTargetException
- Prepares the query wrapping any exceptions as InvocationTargetException.
This method is lazily invoked from execute, but may be invoked eagerly
to detect compilation errors earlier or incur compilation costs at a more
convenient time.
- Specified by:
prepare in interface org.eclipse.emf.ecore.util.QueryDelegate
- Throws:
java.lang.reflect.InvocationTargetException - wrapping any parser, io exceptions
execute
public java.lang.Object execute(java.lang.Object target,
java.util.Map<java.lang.String,?> arguments)
throws java.lang.reflect.InvocationTargetException
- Executes the query for the specified target object. The result
is the OCL evaluation result which may be a Number, String, Collection or
other object for normal returns or a NullLiteralExp for null, or an
InvalidLiteralExp for invalid.
- Specified by:
execute in interface org.eclipse.emf.ecore.util.QueryDelegate
- Parameters:
target - the object on which to execute the query; this must be an
instance of the context with which the delegate was createdarguments - a map of variable names to values; these must correspond to
the variables with which the delegate was created
- Returns:
- the query's result
- Throws:
java.lang.reflect.InvocationTargetException - in case of failure to prepare or execute the query, usually
because of an exception
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object