/[debian]/libjpfcodegen-java/branches/upstream/current/resources/templates/macro.vm
ViewVC logotype

Contents of /libjpfcodegen-java/branches/upstream/current/resources/templates/macro.vm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1609 - (show annotations)
Sun Mar 1 18:00:34 2009 UTC (12 years, 4 months ago) by gregoa
File size: 5342 byte(s)
[svn-inject] Installing original source of libjpfcodegen-java
1
2 #macro( writeClass $para)
3 #if ($para.multiplicity)
4 /**
5 * @return A singleton instance of the class parameter or null if the class could not be found!
6 */
7 @SuppressWarnings("unchecked")
8 public Collection<$para.className> get${para.name}s(){
9 return (Collection<$para.className>)(Collection)getClassParameters("$para.id");
10 }
11 #else
12 /**
13 * @return A singleton instance of the class parameter or null if the class could not be found!
14 */
15 public $para.className get${para.name}(){
16 return ($para.className)getClassParameter("$para.id");
17 }
18 #end
19 #end
20
21 #macro(writeString $para)
22 #if ($para.multiplicity)
23 public Collection<String> get${para.name}s(){
24 return getStringParameters("$para.id");
25 }
26 #else
27 public String get${para.name}(){
28 return getStringParameter("$para.id");
29 }
30 #end
31 #end
32
33 #macro( writeBoolean $para)
34 #if ($para.multiplicity)
35 public Collection<Boolean> get${para.name}s(){
36 return getBooleanParameters("$para.id");
37 }
38 #else
39 public boolean get${para.name}(){
40 return getBooleanParameter("$para.id");
41 }
42 #end
43 #end
44
45 #macro( writeNumber $para)
46 #if ($para.multiplicity)
47 public Collection<Number> get${para.name}s(){
48 return getNumberParameters("$para.id");
49 }
50 #else
51 public Number get${para.name}(){
52 return getNumberParameter("$para.id");
53 }
54 #end
55 #end
56
57 #macro( writeFixed $para)
58 public enum ${para.name} {
59 ${para.enumValues};
60 }
61
62 #if ($para.multiplicity)
63 public Collection<${para.name}> get${para.name}s(){
64 Collection<String> values = getStringParameters("$para.id");
65 Collection<${para.name}> result = new ArrayList<${para.name}>(values.size());
66 for (String s : values){
67 result.add(${para.name}.valueOf(s.toUpperCase()));
68 }
69 return result;
70 }
71 #else
72 public ${para.name} get${para.name}(){
73 return ${para.name}.valueOf(getStringParameter("$para.id").toUpperCase());
74 }
75 #end
76 #end
77
78 #macro( writeDate $para)
79 #if ($para.multiplicity)
80 public Collection<Date> get${para.name}s(){
81 return getDateParameters("$para.id");
82 }
83 #else
84 public Date get${para.name}(){
85 return getDateParameter("$para.id");
86 }
87 #end
88 #end
89
90 #macro( writeParameter $para)
91 #if ($para.multiplicity)
92 public Collection<Parameter> get${para.name}(){
93 return getParameters("$para.id");
94 }
95 #else
96 public Parameter get${para.name}(){
97 return getParameter("$para.id");
98 }
99 #end
100 #end
101
102 #macro( writeResource $para)
103 #if ($para.multiplicity)
104 public Collection<URL> get${para.name}sAsUrls(){
105 return getResourceParameters("$para.id");
106 }
107
108 public Collection<URL> get${para.name}sAsUrls(String relativePath){
109 return getResourceParameters("$para.id", relative);
110 }
111 #else
112 public URL get${para.name}AsUrl(){
113 return getResourceParameter("$para.id");
114 }
115
116 public URL get${para.name}AsUrl(String relativePath){
117 return getResourceParameter("$para.id", relativePath);
118 }
119 #end
120 #end
121
122 ##-------------------------------------------
123 ## writePara
124 ##-------------------------------------------
125 #macro( writePara $para)
126 #if ($para.subclass)
127 #if ($para.multiplicity)
128 /**
129 * Returns all composite extension parameters $para.subclassname.
130 *
131 * The returned collection can be empty.
132 *
133 * @return A collection containing all $para.subclassname
134 * that have been defined for the current extension.
135 */
136 public Collection<$para.subclassname> get${para.subclassname}s(){
137 Collection<Parameter> subparas = getParameters("$para.id");
138 Collection<$para.subclassname> list = new ArrayList<$para.subclassname>(subparas.size());
139 for (Parameter para : subparas){
140 list.add(new ${para.subclassname}(getDeclaringPlugin(), para));
141 }
142 return list;
143 }
144 #else
145 public $para.subclassname get${para.subclassname}(){
146 return new ${para.subclassname}(getDeclaringPlugin(), getParameter("$para.id"));
147 }
148 #end
149
150 public static class $para.subclassname extends SubParameterAccessor {
151
152 public $para.subclassname (Plugin declaringPlugin, Parameter parameter){
153 super(declaringPlugin, parameter);
154 }
155 #end
156
157 #if ($para.type == "class")
158 #writeClass($para)
159 #elseif ($para.type == "string")
160 #writeString($para)
161 #elseif ($para.type == "boolean")
162 #writeBoolean($para)
163 #elseif ($para.type == "number")
164 #writeNumber($para)
165 #elseif ($para.type == "fixed")
166 #writeFixed($para)
167 #elseif (($para.type == "date") || ($para.type == "date-time") || ($para.type == "time"))
168 #writeDate($para)
169 #elseif ($para.type == "resource")
170 #writeResource($para)
171 #else
172 #writeParameter($para)
173 #end
174
175 #if ($para.subclass)
176 #foreach ($subpara in $para.paras)
177 #writePara($subpara)
178 #end
179 }
180 #end
181 #end

  ViewVC Help
Powered by ViewVC 1.1.26