Java Reference
In-Depth Information
Log
To output information on transformation execution to the environment, a log
expression is provided and has the following syntax. This expression is helpful
when debugging QVT scripts or for understanding how they work.
log (message, [object], [level]) [ when condition];
Only the first argument is required, but the output also can include a reference
to the relevant object and a level. The conditional is also optional and can refer-
ence the relevant object. For example:
init {
log ('Input map:', mmap, 3) when mmap.elements->size() > 0;
}
Using M2M QVT OML, this outputs to the console the toString() result of
the mmap object, prefixed by Level 3 - and the String Input map: , as shown
here:
Level 3 - Input map:, data:
org.eclipse.emf.ecore.impl.DynamicEObjectImpl@6fa74a (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@d467a6 (name: Map)
(instanceClassName: null) (abstract: false, interface: false))
The level value has no strict meaning in QVT for log messages, and M2M
QVT OML allows any integer value, leaving it up to the user to specify and inter-
pret levels.
Log output in M2M QVT OML is displayed in the Eclipse Console view.
Optionally, the launch configuration can redirect the output to a file, as discussed
in Section 6.5.4, “Launch Configuration.”
Assert
If a condition needs to be checked during transformation execution, you can use
the assert expression and combine it with the log expression to output infor-
mation. You can assign severity to an assertion with the levels warning , error ,
or fatal , with error being the default. If a fatal severity is declared, the
Search WWH ::




Custom Search