Artefact:Template/org/oogenerator/examples/tutorial/Example0090 TemplateIsAClass
From OOModels
< Artefact:Template | org | oogenerator | examples | tutorial
Jump to navigationJump to search
Revision as of 14:55, 25 July 2008 by AndreasLeue (talk | contribs) (New page: {{Metabox | Meta_Type = Type:org/oogenerator/Template/2.0 | Meta_Domain = Domain:it/development/formatting | Meta_Category = Type:org/oomodels/wiki/Template | Meta_Download = true | ...)
Classification | |
---|---|
Type | Type:org/oogenerator/Template/2.0 |
Domain | Domain:it/development/formatting |
Category | Type:org/oomodels/wiki/Template |
Maturity | final |
More | |
Download Code | |
Namespace (more) | |
OOGenerator main package | |
create new pages |
Code[edit]
G-2.0-plain_java-1.0 ⊰ Each template is translated into a Java class with the same name and in the same package. Therefore, all features of Java classes are available from within templates, too. ⊱… ⊰ Within two characters '▲...▲' you can define class level code. I.e. you can declare variables and define methods. ⊱… ▲ protected void times(int a, int b) { return a * b; } ▲… 3 * 7 = ◂times(3, 7)▸ ⊰ You can declare class level code multiple times, and at arbitrary locations within your template. ⊱… ▲ static final protected float pi = 3.14159265; ▲… « floar r = 1.0; »… area : ◂ pi * r * r ▸