Then you should generate that code out of your model!
The Enterprise Architect code generation templates are written in a proprietary language and provide only limited expressiveness.
With the help of Eclipse-based tools, the EA-Bridges enables quick and easy code generation in Java or Xtend so that templates can easily be extended and customized.
EA-Bridge also provides syntactic model validation out of the box.
Please try it out!