[#if condition]
body
[#elseif condition2]
body
[#elseif condition3]
body
[#else]
body
[/#if]
where:
The if, elseif and else directives conditionally skip a section of the template. The conditions must evaluate to a boolean value. The elseif and else directives must occur inside if (that is, between the if start-tag and end-tag). The if can contain any number of elseif (or none at all) and at the end an optional else.
This code will output a text only if the UML class is abstract :
[#if myClass.isAbstract]
the class is abstract
[/#if]
This code will output a text only if the UML class has some features :
[#if ! myClass.feature.isEmpty()]
the class has at least one feature
[/#if]
This code will output a different text regarding the number of features of a UML class :
[#set size = myClass.feature.size()]
[#if size == 0]
the class has no feature
[#elseif size == 1]
the class has one feature
[#else]
the class has more than one feature
[/#if]