1 | // |
2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 |
3 | // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> |
4 | // Any modifications to this file will be lost upon recompilation of the source schema. |
5 | // Generated on: 2010.02.03 at 01:25:12 AM UTC |
6 | // |
7 | |
8 | |
9 | package org.jomc.model.bootstrap; |
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.XmlType; |
18 | |
19 | |
20 | /** |
21 | * List of services. |
22 | * |
23 | * <p>Java class for Services complex type. |
24 | * |
25 | * <p>The following schema fragment specifies the expected content contained within this class. |
26 | * |
27 | * <pre> |
28 | * <complexType name="Services"> |
29 | * <complexContent> |
30 | * <extension base="{http://jomc.org/model/bootstrap}BootstrapObject"> |
31 | * <sequence> |
32 | * <element ref="{http://jomc.org/model/bootstrap}service" maxOccurs="unbounded" minOccurs="0"/> |
33 | * </sequence> |
34 | * </extension> |
35 | * </complexContent> |
36 | * </complexType> |
37 | * </pre> |
38 | * |
39 | * |
40 | */ |
41 | @XmlAccessorType(XmlAccessType.FIELD) |
42 | @XmlType(name = "Services", propOrder = { |
43 | "service" |
44 | }) |
45 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
46 | public class Services |
47 | extends BootstrapObject |
48 | implements Cloneable |
49 | { |
50 | |
51 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
52 | protected List<Service> service; |
53 | |
54 | /** |
55 | * Creates a new {@code Services} instance. |
56 | * |
57 | */ |
58 | public Services() { |
59 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
60 | super(); |
61 | } |
62 | |
63 | /** |
64 | * Creates a new {@code Services} instance by deeply copying a given {@code Services} instance. |
65 | * |
66 | * |
67 | * @param o |
68 | * The instance to copy. |
69 | * @throws NullPointerException |
70 | * if {@code o} is {@code null}. |
71 | */ |
72 | public Services(final Services o) { |
73 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
74 | super(o); |
75 | if (o == null) { |
76 | throw new NullPointerException("Cannot create a copy of 'Services' from 'null'."); |
77 | } |
78 | // 'Service' collection. |
79 | copyService(o.getService(), getService()); |
80 | } |
81 | |
82 | /** |
83 | * Gets the value of the service property. |
84 | * |
85 | * <p> |
86 | * This accessor method returns a reference to the live list, |
87 | * not a snapshot. Therefore any modification you make to the |
88 | * returned list will be present inside the JAXB object. |
89 | * This is why there is not a <CODE>set</CODE> method for the service property. |
90 | * |
91 | * <p> |
92 | * For example, to add a new item, do as follows: |
93 | * <pre> |
94 | * getService().add(newItem); |
95 | * </pre> |
96 | * |
97 | * |
98 | * <p> |
99 | * Objects of the following type(s) are allowed in the list |
100 | * {@link Service } |
101 | * |
102 | * |
103 | */ |
104 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
105 | public List<Service> getService() { |
106 | if (service == null) { |
107 | service = new ArrayList<Service>(); |
108 | } |
109 | return this.service; |
110 | } |
111 | |
112 | /** |
113 | * Copies all values of property {@code Service} deeply. |
114 | * |
115 | * @param target |
116 | * The target to copy {@code source} to. |
117 | * @param source |
118 | * The source to copy from. |
119 | * @throws NullPointerException |
120 | * if {@code source} or {@code target} is {@code null}. |
121 | */ |
122 | @SuppressWarnings("unchecked") |
123 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
124 | private static void copyService(final List<Service> source, final List<Service> target) { |
125 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
126 | if (!source.isEmpty()) { |
127 | for (Iterator it = source.iterator(); it.hasNext(); ) { |
128 | final Object next = it.next(); |
129 | if (next instanceof Service) { |
130 | // CClassInfo: org.jomc.model.bootstrap.Service |
131 | target.add(((Service) next).clone()); |
132 | continue; |
133 | } |
134 | // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ |
135 | throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Service' of class 'org.jomc.model.bootstrap.Services'.")); |
136 | } |
137 | } |
138 | } |
139 | |
140 | /** |
141 | * Creates and returns a deep copy of this object. |
142 | * |
143 | * |
144 | * @return |
145 | * A deep copy of this object. |
146 | */ |
147 | @Override |
148 | @Generated(value = "com.sun.tools.xjc.Driver", date = "2010-02-03T01:25:12+00:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-833") |
149 | public Services clone() { |
150 | // CC-XJC Version 1.2 Build 2009-11-15T21:50:02+0000 |
151 | return new Services(this); |
152 | } |
153 | |
154 | /** |
155 | * Gets all services for a given identifier from this list of services. |
156 | * |
157 | * @param identifier The identifier of the services to return. |
158 | * |
159 | * @return An unmodifiable, sorted list holding services matching {@code identifier} from the list or an empty list |
160 | * if no services matching {@code identifier} are found. |
161 | * |
162 | * @throws NullPointerException if {@code identifier} is {@code null}. |
163 | * |
164 | * @see #getService() |
165 | */ |
166 | public List<Service> getServices( final String identifier ) |
167 | { |
168 | if ( identifier == null ) |
169 | { |
170 | throw new NullPointerException( "identifier" ); |
171 | } |
172 | |
173 | final java.util.List<Service> services = new java.util.ArrayList<Service>( this.getService().size() ); |
174 | |
175 | for ( Service s : this.getService() ) |
176 | { |
177 | if ( identifier.equals( s.getIdentifier() ) ) |
178 | { |
179 | services.add( s ); |
180 | } |
181 | } |
182 | |
183 | java.util.Collections.sort( services, new java.util.Comparator<Service>() |
184 | { |
185 | |
186 | public int compare( final Service s1, final Service s2 ) |
187 | { |
188 | return s1.getOrdinal() - s2.getOrdinal(); |
189 | } |
190 | |
191 | } ); |
192 | |
193 | return java.util.Collections.unmodifiableList( services ); |
194 | } |
195 | |
196 | /** |
197 | * Gets all services for a given class from this list of services. |
198 | * |
199 | * @param clazz The class of the services to return. |
200 | * |
201 | * @return An unmodifiable, sorted list holding services matching {@code class} from the list or an empty list |
202 | * if no services matching {@code clazz} are found. |
203 | * |
204 | * @throws NullPointerException if {@code clazz} is {@code null}. |
205 | * |
206 | * @see #getService() |
207 | */ |
208 | public List<Service> getServices( final Class clazz ) |
209 | { |
210 | if ( clazz == null ) |
211 | { |
212 | throw new NullPointerException( "clazz" ); |
213 | } |
214 | |
215 | return this.getServices( clazz.getName() ); |
216 | } |
217 | |
218 | |
219 | } |