1
2
3
4
5
6
7
8
9 package org.jomc.modlet;
10
11 import java.util.ArrayList;
12 import java.util.Iterator;
13 import java.util.List;
14 import javax.annotation.Generated;
15 import javax.xml.bind.annotation.XmlAccessType;
16 import javax.xml.bind.annotation.XmlAccessorType;
17 import javax.xml.bind.annotation.XmlElement;
18 import javax.xml.bind.annotation.XmlType;
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 @XmlAccessorType(XmlAccessType.FIELD)
43 @XmlType(name = "Services", namespace = "http://jomc.org/modlet", propOrder = {
44 "service"
45 })
46 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-02T04:26:39+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
47 public class Services
48 extends ModletObject
49 implements Cloneable
50 {
51
52 @XmlElement(namespace = "http://jomc.org/modlet")
53 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-02T04:26:39+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
54 protected List<Service> service;
55
56
57
58
59
60 public Services() {
61
62 super();
63 }
64
65
66
67
68
69
70
71
72
73
74 public Services(final Services o) {
75
76 super(o);
77 if (o == null) {
78 throw new NullPointerException("Cannot create a copy of 'Services' from 'null'.");
79 }
80
81 if (o.service!= null) {
82 copyService(o.getService(), this.getService());
83 }
84 }
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-02T04:26:39+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
109 public List<Service> getService() {
110 if (service == null) {
111 service = new ArrayList<Service>();
112 }
113 return this.service;
114 }
115
116
117
118
119
120
121
122
123
124
125
126 @SuppressWarnings("unchecked")
127 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-02T04:26:39+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
128 private static void copyService(final List<Service> source, final List<Service> target) {
129
130 if ((source!= null)&&(!source.isEmpty())) {
131 for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
132 final Object next = it.next();
133 if (next instanceof Service) {
134
135 target.add(((Service) next).clone());
136 continue;
137 }
138
139 throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Service' of class 'org.jomc.modlet.Services'."));
140 }
141 }
142 }
143
144
145
146
147
148
149
150
151 @Override
152 @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-02T04:26:39+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2")
153 public Services clone() {
154 {
155
156 final Services clone = ((Services) super.clone());
157
158 if (this.service!= null) {
159 clone.service = null;
160 copyService(this.getService(), clone.getService());
161 }
162 return clone;
163 }
164 }
165
166
167
168
169
170
171
172
173
174
175
176
177
178 public List<Service> getServices( final String identifier )
179 {
180 if ( identifier == null )
181 {
182 throw new NullPointerException( "identifier" );
183 }
184
185 final java.util.List<Service> services = new java.util.ArrayList<Service>( this.getService().size() );
186
187 for ( int i = 0, s0 = this.getService().size(); i < s0; i++ )
188 {
189 final Service s = this.getService().get( i );
190
191 if ( identifier.equals( s.getIdentifier() ) )
192 {
193 services.add( s );
194 }
195 }
196
197 java.util.Collections.sort( services, new java.util.Comparator<Service>()
198 {
199
200 public int compare( final Service s1, final Service s2 )
201 {
202 return s1.getOrdinal() - s2.getOrdinal();
203 }
204
205 } );
206
207 return java.util.Collections.unmodifiableList( services );
208 }
209
210
211
212
213
214
215
216
217
218
219
220
221
222 public List<Service> getServices( final Class<?> clazz )
223 {
224 if ( clazz == null )
225 {
226 throw new NullPointerException( "clazz" );
227 }
228
229 return this.getServices( clazz.getName() );
230 }
231
232
233 }