Provides utilities for modifying a type from a member type node type derivation script.
ModifyType.modifyScript(options) |
Modify a script method associated with the type to include additional code. The additional code can be specified as a node and optional method to be called, as a block of script, or as a function. Options are:
The new functionality is only called if there are no application errors. call, script and fn are mutually exclusive, and callMethod can only be set if call is used. If call is used the application attribute contextMemberType will be set. If a function is used, the text of the function will be included. The function will be passed the contextMemberType. Global variables and function used from the function will be evaluated within the type method, so the function must be completely self-contained. If script is used, the script wil be embedded in a function and called as if a function were passed. contextMemberType will be passed to the function. The method will raise an exception if it detects any errors in the parameters. This will cause a derivation error in the type. Examples of generated code If call is set: { where scriptNode is mycompany.products.myproduct.library.SomeScript, then the generated code will be: if ( !application.errorFound() ) { contextMemberTypeReference will be set to the reference of the context member type passed to modifyScript(). If script is set: { Then the generated code will be: if ( !application.errorFound() ) { If fn is set: { Then the generated code will be: if ( !application.errorFound() ) { Note that "application.getContext()" will be evaluated from within the type's method, not in the member type's code. Generally:
|
||||||||||||||||
ModifyType.setProperty(property,value,append) |
Set or overwrite the given property. If append is false (the default), then if the property already exists it is overwritten. If append is true, then if the property already exists append the value to it after a newline. |
||||||||||||||||
ModifyType.deleteMemberType(memberType); |
Delete a member type from the type. memberType defaults to the context member type. |