public class NonTransformationExecutionContext extends Object
The motivation of this class is allowing a generic client to reuse existing QVT Libraries in other execution environments. Operation call objects can be invoked within a given execution context.
The execution context is constructed with as set of library modules that are imported into the scope of the context. Only QVT libraries and its helper operations are supported, only operations from the libraries that are already imported in the context can be called.
See the following example code snippet:Module module = ...; // get a valid AST of a library NonTransformationExecutionContext execContext = new NonTransformationExecutionContext(Collections.singleton(module)); // find a helper method of interest Helper operation = findOperationByName(module, "fooHelper"); // create a call object for the operation HelperOperationCall call = execContext.createHelperCall(operation); // calls with the 'self' contextual instance actual parameter values call.invoke("aContextString1", new Object[] { "aStringArg1" }); call.invoke("aContextString2", new Object[] { "aStringArg2" }); ... // we finished our work execContext.dispose();
Constructor and Description |
---|
NonTransformationExecutionContext(Set<Module> libraryImports)
Constructs new execution context and imports the given list of
|
Modifier and Type | Method and Description |
---|---|
HelperOperationCall |
createHelperCall(Helper operation)
Creates the call object for the give helper operation.
|
void |
dispose()
Disposes this execution context.
|
String |
toString() |
public NonTransformationExecutionContext(Set<Module> libraryImports)
libraryImports
- the QVT libraries to be imported into the scope of the
execution contextIllegalArgumentException
- if libraryImports
is null
public HelperOperationCall createHelperCall(Helper operation)
Note: A helper operation is either a query
or a
helper
with side effects
operation
- an operation defined in one of the libraries imported into
this execution contextIllegalArgumentException
- if the given operation is not from a library already
imported to this execution contextpublic void dispose()
Frees any resources acquired by this context during execution
Copyright © 2008, 2018 Borland Software Corporation and others. All Rights Reserved.