001// 002// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 003// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 004// Any modifications to this file will be lost upon recompilation of the source schema. 005// Generated on: 2014.02.24 at 05:13:57 AM MEZ 006// 007 008 009package org.jomc.tools.model; 010 011import javax.annotation.Generated; 012import javax.xml.bind.annotation.XmlAccessType; 013import javax.xml.bind.annotation.XmlAccessorType; 014import javax.xml.bind.annotation.XmlAttribute; 015import javax.xml.bind.annotation.XmlSeeAlso; 016import javax.xml.bind.annotation.XmlType; 017 018 019/** 020 * Base tools type. 021 * 022 * <p>Java class for ToolsType complex type. 023 * 024 * <p>The following schema fragment specifies the expected content contained within this class. 025 * 026 * <pre> 027 * <complexType name="ToolsType"> 028 * <complexContent> 029 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> 030 * <attribute name="modelVersion" type="{http://www.w3.org/2001/XMLSchema}string" default="1.6" /> 031 * </restriction> 032 * </complexContent> 033 * </complexType> 034 * </pre> 035 * 036 * 037 */ 038@XmlAccessorType(XmlAccessType.FIELD) 039@XmlType(name = "ToolsType", namespace = "http://jomc.org/tools/model") 040@XmlSeeAlso({ 041 SourceSectionType.class, 042 SourceSectionsType.class, 043 SourceFileType.class, 044 SourceFilesType.class, 045 TemplateParameterType.class 046}) 047@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-24T05:13:56+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 048public class ToolsType implements Cloneable 049{ 050 051 @XmlAttribute(name = "modelVersion") 052 @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-24T05:13:56+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 053 protected String modelVersion; 054 055 /** 056 * Creates a new {@code ToolsType} instance. 057 * 058 */ 059 public ToolsType() { 060 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 061 super(); 062 } 063 064 /** 065 * Creates a new {@code ToolsType} instance by deeply copying a given {@code ToolsType} instance. 066 * 067 * 068 * @param o 069 * The instance to copy. 070 * @throws NullPointerException 071 * if {@code o} is {@code null}. 072 */ 073 public ToolsType(final ToolsType o) { 074 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 075 super(); 076 if (o == null) { 077 throw new NullPointerException("Cannot create a copy of 'ToolsType' from 'null'."); 078 } 079 // CBuiltinLeafInfo: java.lang.String 080 this.modelVersion = ((o.modelVersion == null)?null:o.getModelVersion()); 081 } 082 083 /** 084 * Gets the value of the modelVersion property. 085 * 086 * @return 087 * possible object is 088 * {@link String } 089 * 090 */ 091 @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-24T05:13:56+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 092 public String getModelVersion() { 093 if (modelVersion == null) { 094 return "1.6"; 095 } else { 096 return modelVersion; 097 } 098 } 099 100 /** 101 * Sets the value of the modelVersion property. 102 * 103 * @param value 104 * allowed object is 105 * {@link String } 106 * 107 */ 108 @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-24T05:13:56+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 109 public void setModelVersion(String value) { 110 this.modelVersion = value; 111 } 112 113 /** 114 * Creates and returns a deep copy of this object. 115 * 116 * 117 * @return 118 * A deep copy of this object. 119 */ 120 @Override 121 @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-02-24T05:13:56+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") 122 public ToolsType clone() { 123 try { 124 { 125 // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 126 final ToolsType clone = ((ToolsType) super.clone()); 127 // CBuiltinLeafInfo: java.lang.String 128 clone.modelVersion = ((this.modelVersion == null)?null:this.getModelVersion()); 129 return clone; 130 } 131 } catch (CloneNotSupportedException e) { 132 // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ 133 throw new AssertionError(e); 134 } 135 } 136 137 /** 138 * Gets a single {@code JAXBElement} matching a namespace URI and local part from a given list of objects. 139 * 140 * @param any The list to search. 141 * @param namespaceURI The namespace URI of the {@code JAXBElement} to return. 142 * @param localPart The local part of the {@code JAXBElement} to return. 143 * @param type The class of the type the element is bound to. 144 * @param <T> The type the element is bound to. 145 * 146 * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} list or 147 * {@code null} if no such element is found. 148 * 149 * @throws NullPointerException if {@code any}, {@code namespaceURI}, {@code localPart} or {@code type} is 150 * {@code null}. 151 * @throws IllegalStateException if {@code any} contains more than one matching element. 152 */ 153 protected <T> javax.xml.bind.JAXBElement<T> getAnyElement( final java.util.List<Object> any, 154 final String namespaceURI, 155 final String localPart, 156 final Class<T> type ) 157 { 158 if ( any == null ) 159 { 160 throw new NullPointerException( "any" ); 161 } 162 if ( namespaceURI == null ) 163 { 164 throw new NullPointerException( "namespaceURI" ); 165 } 166 if ( localPart == null ) 167 { 168 throw new NullPointerException( "localPart" ); 169 } 170 if ( type == null ) 171 { 172 throw new NullPointerException( "type" ); 173 } 174 175 javax.xml.bind.JAXBElement<?> anyElement = null; 176 177 for ( int i = 0, s0 = any.size(); i < s0; i++ ) 178 { 179 final Object o = any.get( i ); 180 181 if ( o instanceof javax.xml.bind.JAXBElement<?> ) 182 { 183 final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o; 184 185 if ( namespaceURI.equals( e.getName().getNamespaceURI() ) 186 && localPart.equals( e.getName().getLocalPart() ) ) 187 { 188 if ( anyElement == null ) 189 { 190 anyElement = e; 191 } 192 else 193 { 194 throw new IllegalStateException( getMessage( "nonUniqueElement", this.getClass().getName(), 195 namespaceURI, localPart ) ); 196 197 } 198 } 199 } 200 } 201 202 if ( anyElement != null && anyElement.getValue() != null && anyElement.getValue().getClass().equals( type ) ) 203 { 204 @SuppressWarnings( "unchecked" ) final javax.xml.bind.JAXBElement<T> e = 205 (javax.xml.bind.JAXBElement<T>) anyElement; 206 207 return e; 208 } 209 210 return null; 211 } 212 213 /** 214 * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from a given list of 215 * objects. 216 * 217 * @param any The list to search. 218 * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return. 219 * @param localPart The local part of the {@code JAXBElement}s to return. 220 * @param type The class of the type the elements are bound to. 221 * @param <T> The type the elements are bound to. 222 * 223 * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from 224 * the {@code any} list - an empty list if no such elements are found. 225 * 226 * @throws NullPointerException if {@code any}, {@code namespaceURI}, {@code localPart} or {@code type} is 227 * {@code null}. 228 */ 229 protected <T> java.util.List<javax.xml.bind.JAXBElement<T>> getAnyElements( final java.util.List<Object> any, 230 final String namespaceURI, 231 final String localPart, 232 final Class<T> type ) 233 { 234 if ( any == null ) 235 { 236 throw new NullPointerException( "any" ); 237 } 238 if ( namespaceURI == null ) 239 { 240 throw new NullPointerException( "namespaceURI" ); 241 } 242 if ( localPart == null ) 243 { 244 throw new NullPointerException( "localPart" ); 245 } 246 if ( type == null ) 247 { 248 throw new NullPointerException( "type" ); 249 } 250 251 final java.util.List<javax.xml.bind.JAXBElement<T>> anyElements = 252 new java.util.ArrayList<javax.xml.bind.JAXBElement<T>>( any.size() ); 253 254 for ( int i = 0, s0 = any.size(); i < s0; i++ ) 255 { 256 final Object o = any.get( i ); 257 258 if ( o instanceof javax.xml.bind.JAXBElement<?> ) 259 { 260 final javax.xml.bind.JAXBElement<?> e = (javax.xml.bind.JAXBElement<?>) o; 261 262 if ( namespaceURI.equals( e.getName().getNamespaceURI() ) 263 && localPart.equals( e.getName().getLocalPart() ) 264 && e.getValue() != null && e.getValue().getClass().equals( type ) ) 265 { 266 @SuppressWarnings( "unchecked" ) final javax.xml.bind.JAXBElement<T> anyElement = 267 (javax.xml.bind.JAXBElement<T>) e; 268 269 anyElements.add( anyElement ); 270 } 271 } 272 } 273 274 return java.util.Collections.unmodifiableList( anyElements ); 275 } 276 277 /** 278 * Gets a single object matching a class from a given list of objects. 279 * 280 * @param any The list to search. 281 * @param clazz The class to return an instance of. 282 * @param <T> The type of the object to return. 283 * 284 * @return The instance of {@code clazz} from the {@code any} list or {@code null}, if no such instance is found. 285 * 286 * @throws NullPointerException if {@code any} or {@code clazz} is {@code null}. 287 * @throws IllegalStateException if {@code any} contains more than one matching object. 288 */ 289 protected <T> T getAnyObject( final java.util.List<Object> any, final Class<T> clazz ) 290 { 291 if ( any == null ) 292 { 293 throw new NullPointerException( "any" ); 294 } 295 if ( clazz == null ) 296 { 297 throw new NullPointerException( "clazz" ); 298 } 299 300 T anyObject = null; 301 302 for ( int i = 0, s0 = any.size(); i < s0; i++ ) 303 { 304 Object o = any.get( i ); 305 306 if ( o instanceof javax.xml.bind.JAXBElement<?> ) 307 { 308 o = ( (javax.xml.bind.JAXBElement<?>) o ).getValue(); 309 } 310 311 if ( clazz.equals( o.getClass() ) ) 312 { 313 if ( anyObject == null ) 314 { 315 @SuppressWarnings( "unchecked" ) final T object = (T) o; 316 anyObject = object; 317 } 318 else 319 { 320 throw new IllegalStateException( getMessage( "nonUniqueObject", this.getClass().getName(), 321 clazz.getName() ) ); 322 323 } 324 } 325 } 326 327 return anyObject; 328 } 329 330 /** 331 * Gets a list containing all objects matching a class from a given list of objects. 332 * 333 * @param any The list to search. 334 * @param clazz The class to return all instances of. 335 * @param <T> The type of the objects to return. 336 * 337 * @return An unmodifiable list of all instances of {@code clazz} from the {@code any} list - an empty list if no 338 * such objects are found. 339 * 340 * @throws NullPointerException if {@code any} or {@code clazz} is {@code null}. 341 */ 342 protected <T> java.util.List<T> getAnyObjects( final java.util.List<Object> any, final Class<T> clazz ) 343 { 344 if ( any == null ) 345 { 346 throw new NullPointerException( "any" ); 347 } 348 if ( clazz == null ) 349 { 350 throw new NullPointerException( "namespaceURI" ); 351 } 352 353 final java.util.List<T> anyElements = new java.util.ArrayList<T>( any.size() ); 354 355 for ( int i = 0, s0 = any.size(); i < s0; i++ ) 356 { 357 Object o = any.get( i ); 358 359 if ( o instanceof javax.xml.bind.JAXBElement<?> ) 360 { 361 o = ( (javax.xml.bind.JAXBElement<?>) o ).getValue(); 362 } 363 364 if ( clazz.equals( o.getClass() ) ) 365 { 366 @SuppressWarnings( "unchecked" ) final T object = (T) o; 367 anyElements.add( object ); 368 } 369 } 370 371 return java.util.Collections.unmodifiableList( anyElements ); 372 } 373 374 private static String getMessage( final String key, final Object... args ) 375 { 376 return java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( 377 ToolsType.class.getName().replace( '.', '/' ), java.util.Locale.getDefault() ). 378 getString( key ), args ); 379 } 380 381}