All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jomc.modlet.ModletObject Maven / Gradle / Ivy

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 
// See http://java.sun.com/xml/jaxb 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2013.01.04 at 08:47:18 AM MEZ 
//


package org.jomc.modlet;

import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;


/**
 * Base modlet object.
 * 
 * 

Java class for ModletObject complex type. * *

The following schema fragment specifies the expected content contained within this class. * *

 * <complexType name="ModletObject">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ModletObject", namespace = "http://jomc.org/modlet") @XmlSeeAlso({ Schema.class, Services.class, Schemas.class, Model.class, Modlets.class, Modlet.class, Service.class, Property.class }) @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") public class ModletObject implements Cloneable { /** * Creates a new {@code ModletObject} instance. * */ public ModletObject() { // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 super(); } /** * Creates a new {@code ModletObject} instance by deeply copying a given {@code ModletObject} instance. * * * @param o * The instance to copy. * @throws NullPointerException * if {@code o} is {@code null}. */ public ModletObject(final ModletObject o) { // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 super(); if (o == null) { throw new NullPointerException("Cannot create a copy of 'ModletObject' from 'null'."); } } /** * Creates and returns a deep copy of this object. * * * @return * A deep copy of this object. */ @Override @Generated(value = "com.sun.tools.xjc.Driver", date = "2013-01-04T08:47:18+01:00", comments = "JAXB RI vhudson-jaxb-ri-2.1-2") public ModletObject clone() { try { { // CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000 final ModletObject clone = ((ModletObject) super.clone()); return clone; } } catch (CloneNotSupportedException e) { // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ throw new AssertionError(e); } } /** Public identifier of the modlet model. */ public static final String MODEL_PUBLIC_ID = "http://jomc.org/modlet"; /** * Public identifier of the modlet schema. * @since 1.2 */ public static final java.net.URI PUBLIC_ID; static { try { PUBLIC_ID = new java.net.URI( MODEL_PUBLIC_ID ); } catch ( final java.net.URISyntaxException e ) { throw new AssertionError( e ); } } /** * Gets a single {@code JAXBElement} matching a namespace URI and local part from a given list of objects. * * @param any The list to search. * @param namespaceURI The namespace URI of the {@code JAXBElement} to return. * @param localPart The local part of the {@code JAXBElement} to return. * * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} list or * {@code null} if no such element is found. * * @throws NullPointerException if {@code any}, {@code namespaceURI} or {@code localPart} is {@code null}. * @throws IllegalStateException if {@code any} contains more than one matching element. * * @deprecated As of JOMC 1.1, please use method {@link #getAnyElement(java.util.List, java.lang.String, java.lang.String, java.lang.Class)}. * This method will be removed in version 2.0. */ @Deprecated protected javax.xml.bind.JAXBElement getAnyElement( final java.util.List any, final String namespaceURI, final String localPart ) { if ( any == null ) { throw new NullPointerException( "any" ); } if ( namespaceURI == null ) { throw new NullPointerException( "namespaceURI" ); } if ( localPart == null ) { throw new NullPointerException( "localPart" ); } javax.xml.bind.JAXBElement anyElement = null; for ( int i = 0, s0 = any.size(); i < s0; i++ ) { final Object o = any.get( i ); if ( o instanceof javax.xml.bind.JAXBElement ) { final javax.xml.bind.JAXBElement e = (javax.xml.bind.JAXBElement) o; if ( namespaceURI.equals( e.getName().getNamespaceURI() ) && localPart.equals( e.getName().getLocalPart() ) ) { if ( anyElement == null ) { anyElement = e; } else { throw new IllegalStateException( getMessage( "nonUniqueElement", this.getClass().getName(), namespaceURI, localPart ) ); } } } } return anyElement; } /** * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from a given list of * objects. * * @param any The list to search. * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return. * @param localPart The local part of the {@code JAXBElement}s to return. * * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from * the {@code any} list - an empty list if no such elements are found. * * @throws NullPointerException if {@code any}, {@code namespaceURI} or {@code localPart} is {@code null}. * * @deprecated As of JOMC 1.1, please use method {@link #getAnyElements(java.util.List, java.lang.String, java.lang.String, java.lang.Class)}. * This method will be removed in version 2.0. */ @Deprecated protected java.util.List getAnyElements( final java.util.List any, final String namespaceURI, final String localPart ) { if ( any == null ) { throw new NullPointerException( "any" ); } if ( namespaceURI == null ) { throw new NullPointerException( "namespaceURI" ); } if ( localPart == null ) { throw new NullPointerException( "localPart" ); } final java.util.List anyElements = new java.util.ArrayList( any.size() ); for ( int i = 0, s0 = any.size(); i < s0; i++ ) { final Object o = any.get( i ); if ( o instanceof javax.xml.bind.JAXBElement ) { final javax.xml.bind.JAXBElement e = (javax.xml.bind.JAXBElement) o; if ( namespaceURI.equals( e.getName().getNamespaceURI() ) && localPart.equals( e.getName().getLocalPart() ) ) { anyElements.add( e ); } } } return java.util.Collections.unmodifiableList( anyElements ); } /** * Gets a single {@code JAXBElement} matching a namespace URI and local part from a given list of objects. * * @param any The list to search. * @param namespaceURI The namespace URI of the {@code JAXBElement} to return. * @param localPart The local part of the {@code JAXBElement} to return. * @param type The class of the type the element is bound to. * @param The type the element is bound to. * * @return The {@code JAXBElement} matching {@code namespaceURI} and {@code localPart} from the {@code any} list or * {@code null} if no such element is found. * * @throws NullPointerException if {@code any}, {@code namespaceURI}, {@code localPart} or {@code type} is * {@code null}. * @throws IllegalStateException if {@code any} contains more than one matching element. * * @since 1.1 */ protected javax.xml.bind.JAXBElement getAnyElement( final java.util.List any, final String namespaceURI, final String localPart, final Class type ) { if ( any == null ) { throw new NullPointerException( "any" ); } if ( namespaceURI == null ) { throw new NullPointerException( "namespaceURI" ); } if ( localPart == null ) { throw new NullPointerException( "localPart" ); } if ( type == null ) { throw new NullPointerException( "type" ); } javax.xml.bind.JAXBElement anyElement = null; for ( int i = 0, s0 = any.size(); i < s0; i++ ) { final Object o = any.get( i ); if ( o instanceof javax.xml.bind.JAXBElement ) { final javax.xml.bind.JAXBElement e = (javax.xml.bind.JAXBElement) o; if ( namespaceURI.equals( e.getName().getNamespaceURI() ) && localPart.equals( e.getName().getLocalPart() ) ) { if ( anyElement == null ) { anyElement = e; } else { throw new IllegalStateException( getMessage( "nonUniqueElement", this.getClass().getName(), namespaceURI, localPart ) ); } } } } if ( anyElement != null && anyElement.getValue() != null && anyElement.getValue().getClass().equals( type ) ) { @SuppressWarnings( "unchecked" ) final javax.xml.bind.JAXBElement e = (javax.xml.bind.JAXBElement) anyElement; return e; } return null; } /** * Gets a list containing all {@code JAXBElement}s matching a namespace URI and local part from a given list of * objects. * * @param any The list to search. * @param namespaceURI The namespace URI of the {@code JAXBElement}s to return. * @param localPart The local part of the {@code JAXBElement}s to return. * @param type The class of the type the elements are bound to. * @param The type the elements are bound to. * * @return An unmodifiable list of all {@code JAXBElement}s matching {@code namespaceURI} and {@code localPart} from * the {@code any} list - an empty list if no such elements are found. * * @throws NullPointerException if {@code any}, {@code namespaceURI}, {@code localPart} or {@code type} is * {@code null}. * * @since 1.1 */ protected java.util.List> getAnyElements( final java.util.List any, final String namespaceURI, final String localPart, final Class type ) { if ( any == null ) { throw new NullPointerException( "any" ); } if ( namespaceURI == null ) { throw new NullPointerException( "namespaceURI" ); } if ( localPart == null ) { throw new NullPointerException( "localPart" ); } if ( type == null ) { throw new NullPointerException( "type" ); } final java.util.List> anyElements = new java.util.ArrayList>( any.size() ); for ( int i = 0, s0 = any.size(); i < s0; i++ ) { final Object o = any.get( i ); if ( o instanceof javax.xml.bind.JAXBElement ) { final javax.xml.bind.JAXBElement e = (javax.xml.bind.JAXBElement) o; if ( namespaceURI.equals( e.getName().getNamespaceURI() ) && localPart.equals( e.getName().getLocalPart() ) && e.getValue() != null && e.getValue().getClass().equals( type ) ) { @SuppressWarnings( "unchecked" ) final javax.xml.bind.JAXBElement anyElement = (javax.xml.bind.JAXBElement) e; anyElements.add( anyElement ); } } } return java.util.Collections.unmodifiableList( anyElements ); } /** * Gets a single object matching a class from a given list of objects. * * @param any The list to search. * @param clazz The class to return an instance of. * @param The type of the object to return. * * @return The instance of {@code clazz} from the {@code any} list or {@code null}, if no such instance is found. * * @throws NullPointerException if {@code any} or {@code clazz} is {@code null}. * @throws IllegalStateException if {@code any} contains more than one matching object. */ protected T getAnyObject( final java.util.List any, final Class clazz ) { if ( any == null ) { throw new NullPointerException( "any" ); } if ( clazz == null ) { throw new NullPointerException( "clazz" ); } T anyObject = null; for ( int i = 0, s0 = any.size(); i < s0; i++ ) { Object o = any.get( i ); if ( o instanceof javax.xml.bind.JAXBElement ) { o = ( (javax.xml.bind.JAXBElement) o ).getValue(); } if ( clazz.equals( o.getClass() ) ) { if ( anyObject == null ) { @SuppressWarnings( "unchecked" ) final T object = (T) o; anyObject = object; } else { throw new IllegalStateException( getMessage( "nonUniqueObject", this.getClass().getName(), clazz.getName() ) ); } } } return anyObject; } /** * Gets a list containing all objects matching a class from a given list of objects. * * @param any The list to search. * @param clazz The class to return all instances of. * @param The type of the objects to return. * * @return An unmodifiable list of all instances of {@code clazz} from the {@code any} list - an empty list if no * such objects are found. * * @throws NullPointerException if {@code any} or {@code clazz} is {@code null}. */ protected java.util.List getAnyObjects( final java.util.List any, final Class clazz ) { if ( any == null ) { throw new NullPointerException( "any" ); } if ( clazz == null ) { throw new NullPointerException( "namespaceURI" ); } final java.util.List anyElements = new java.util.ArrayList( any.size() ); for ( int i = 0, s0 = any.size(); i < s0; i++ ) { Object o = any.get( i ); if ( o instanceof javax.xml.bind.JAXBElement ) { o = ( (javax.xml.bind.JAXBElement) o ).getValue(); } if ( clazz.equals( o.getClass() ) ) { @SuppressWarnings( "unchecked" ) final T object = (T) o; anyElements.add( object ); } } return java.util.Collections.unmodifiableList( anyElements ); } private static String getMessage( final String key, final Object... args ) { return java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( ModletObject.class.getName().replace( '.', '/' ), java.util.Locale.getDefault() ). getString( key ), args ); } }