Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 644 Bytes

4-default-attribute-values.md

File metadata and controls

25 lines (19 loc) · 644 Bytes

Default Attribute Values

Attributes (but not associations) can be initialized with a default value. This is possible using the @InitialValue annotation, which takes a string representing a Java expression.

src/gen/java/org/fulib/docs/GenModel.java:

@InitialValue("\"P1\"")
String label;

@InitialValue("100")
int score;

src/main/java/org/fulib/docs/Player.java:

private String label = "P1";
private int score = 100;