Now we want to generate a Java method for each operation defined on a Class:
You can see the Class Order has an operation findLineItem
linked through the reference operations.

We will start by adding a declaration script on operation to generate the declaration for an operation.

A file rhapsody_Operation.tgs is created that allows us
to define TGL scripts on the metatype Operation.
Change its contents to:
[#package tutorial.java]
[#metatype rhapsody.Operation]
[#script public declaration]
public Object ${self.name}() {
return null;
}
[/#script]
The declaration script can now be called from the main template.
[#package tutorial.java]
[#template public JavaSource(class : rhapsody.Class)]
[#file]generated/${class.name}.java[/#file]
public class ${class.name} {
[#-- Attributes declaration --]
[#foreach attr : rhapsody.Attribute in class.attributes]
private ${attr.type.name} ${attr.name};
[/#foreach]
[#-- Relations declaration --]
[#foreach rel : rhapsody.Relation in class.relations]
private ${rel.javaType} ${rel.name};
[/#foreach]
[#-- Operations declaration --]
[#foreach operation : rhapsody.Operation in class.operations]
${operation.declaration}[#trim]
[/#foreach]
}
[/#template]
Next Section: Add return type declaration
Prev Section: Call the script from the template