Wiki source code of Veogen Tips and Tricks
Last modified by chuckhill on 2008/03/03 19:31
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 1 | === Accessing Values === |
2 | |||
![]() |
3.1 | 3 | Simple expressions like **${relationship.actualDestination.classNameWithDefault}** work as long as the methods use the is... or get... prefix from JavaBeans. For other methods, use **()** to indicate that it is a regular method name: **${attribute.name.toUpperCase()}**. |
![]() |
1.1 | 4 | |
5 | === Number vs Integer or Long === | ||
6 | |||
7 | If you prefer your classes to be generated with Number instead of Integer or Long, add this macro to the start of your template: | ||
8 | |||
9 | {{code}} | ||
10 | |||
11 | #macro( genericClass $specificClass ) | ||
12 | #if($specificClass == "Integer" || $specificClass == "Long")Number#else$specificClass#end | ||
13 | #end | ||
14 | |||
15 | {{/code}} | ||
16 | |||
17 | And use it like this: | ||
18 | |||
19 | {{code}} | ||
20 | |||
21 | public #genericClass($attribute.javaClassName) ${attribute.name}() { | ||
22 | return (#genericClass($attribute.javaClassName)) storedValueForKey("$attribute.name"); | ||
23 | } | ||
24 | |||
25 | public void set${attribute.capitalizedName}(#genericClass($attribute.javaClassName) value) | ||
26 | { | ||
27 | takeStoredValueForKey(value, "$attribute.name"); | ||
28 | } | ||
29 | |||
30 | {{/code}} |