MOFScript
supports the notion of unprotected blocks. These blocks are created
with the
use of the unprotect keyword in the
transformation code, as illustrated in the transformation code for
operations
below.
self.ownedOperation->forEach(o:uml.Operation){
'\n 'o.visibility' void ' o.name'(){'
unprotect{
'
//User code here for operation'
}
' }\n'
}
The resulting code, shown below, represents
the unprotected block as comments containing a #BlockStart
and a #BlockEnd
and an identifier for the source model element.
public
void
printAuthor(){
//#BlockStart
number=4 id=_MeMJULEPEdu-Vepu7rgPLg
//User code here for operation
//#BlockEnd
number=4
}