replaced all StringBuffers with StringBuilder to improve performance
[Bob.git] / templates / finder.vm
blob6ead1e724b5a502e979c42251bb314f7ffda9af6
1 \r
2 \r
3 ## PACKAGE DECISION\r
4 ## public $!{package_}.G${tagUpper} find${tagUpper}By${attributeUpper}(String value) {\r
5 \r
6 #if( ${package_} != "" )\r
7 public $!{package_}.I${tagUpper} find${tagUpper}By${attributeUpper}(String value) {\r
8 #else\r
9 public I${tagUpper} find${tagUpper}By${attributeUpper}(String value) {\r
10 #end\r
11     \r
12     ## java.util.Iterator iter = ${tag}s_.iterator();\r
13     ## java.util.ListIterator iter = ${tag}s_.listIterator();\r
14     java.util.Iterator iter = _children.iterator();\r
16     #if( ${package_} != "" )\r
17     $!{package_}.I${tagUpper} each = null;\r
18     #else\r
19     I${tagUpper} each = null;\r
20     #end\r
21     \r
22     while(iter.hasNext()) {\r
23         \r
24         Object next = iter.next();\r
25         #if( ${package_} != "" )\r
26         if(next instanceof $!{package_}.I${tagUpper}) {\r
27         #else\r
28         if(next instanceof I${tagUpper}) {\r
29         #end\r
30         \r
31         #if( ${package_} != "" )\r
32         //each = ($!{package_}.I${tagUpper})iter.next();\r
33         each = ($!{package_}.I${tagUpper})next;\r
34         #else\r
35         //each = (I${tagUpper})iter.next();\r
36         each = (I${tagUpper})next;\r
37         #end\r
39         String comparator = each.get${attributeUpper}();\r
40         \r
41         if(comparator.equals(value)) {\r
42             //break;\r
43             return each;\r
44         }\r
45         }\r
46     }\r
47     return null;\r
48 }\r