Call the script from the template

We need to update the text template contents to call the newly created javaType script:

[#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]
}
[/#template]

Relaunch the generation and open the file Order.java:

public class Order {

    private String date;

    private Customer customer;
    private java.util.Collection items;
}

Next Section: Add methods declaration
Prev Section: Add a script to handle the multiplicity


Related reference
foreach directive
default value expression
null management