/*
* Dog - Core
*
* Copyright (c) 2009-2014 Dario Bonino and Luigi De Russis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.02.15 at 03:00:00 PM CEST
//
package it.polito.elite.dog.core.library.jaxb;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InvalidClassException;
import java.io.NotSerializableException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OptionalDataException;
import java.io.Serializable;
import java.io.StreamCorruptedException;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Currency;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.UUID;
import javax.activation.MimeType;
import javax.activation.MimeTypeParseException;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlIDREF;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
import org.codehaus.jackson.annotate.JsonProperty;
/**
* <p>Java class for wall complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="wall">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="hasWallOpening" type="{http://elite.polito.it/dogHomeConfiguration}wallOpening" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" />
* <attribute name="length" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="height" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="class" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="ref" type="{http://www.w3.org/2001/XMLSchema}IDREF" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "wall", propOrder = {
"hasWallOpening"
})
public class Wall implements Cloneable
{
protected List<WallOpening> hasWallOpening;
@XmlAttribute(name = "id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
@XmlAttribute(name = "length")
protected String length;
@XmlAttribute(name = "height")
protected String height;
@XmlAttribute(name = "class")
@JsonProperty("class")
protected String clazz;
@XmlAttribute(name = "ref")
@XmlIDREF
@XmlSchemaType(name = "IDREF")
protected Object ref;
/**
* Creates a new {@code Wall} instance.
*
*/
public Wall() {
// CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
super();
}
/**
* Creates a new {@code Wall} instance by deeply copying a given {@code Wall} instance.
*
*
* @param o
* The instance to copy.
* @throws NullPointerException
* if {@code o} is {@code null}.
*/
public Wall(final Wall 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 'Wall' from 'null'.");
}
// 'HasWallOpening' collection.
if (o.hasWallOpening!= null) {
copyHasWallOpening(o.getHasWallOpening(), this.getHasWallOpening());
}
// CBuiltinLeafInfo: java.lang.String
this.id = ((o.id == null)?null:o.getId());
// CBuiltinLeafInfo: java.lang.String
this.length = ((o.length == null)?null:o.getLength());
// CBuiltinLeafInfo: java.lang.String
this.height = ((o.height == null)?null:o.getHeight());
// CBuiltinLeafInfo: java.lang.String
this.clazz = ((o.clazz == null)?null:o.getClazz());
// CBuiltinLeafInfo: java.lang.Object
this.ref = ((o.ref == null)?null:copyOf(o.getRef()));
}
/**
* Gets the value of the hasWallOpening property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the hasWallOpening property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getHasWallOpening().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link WallOpening }
*
*
*/
public List<WallOpening> getHasWallOpening() {
if (hasWallOpening == null) {
hasWallOpening = new ArrayList<WallOpening>();
}
return this.hasWallOpening;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the length property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLength() {
return length;
}
/**
* Sets the value of the length property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLength(String value) {
this.length = value;
}
/**
* Gets the value of the height property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHeight() {
return height;
}
/**
* Sets the value of the height property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHeight(String value) {
this.height = value;
}
/**
* Gets the value of the clazz property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getClazz() {
return clazz;
}
/**
* Sets the value of the clazz property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setClazz(String value) {
this.clazz = value;
}
/**
* Gets the value of the ref property.
*
* @return
* possible object is
* {@link Object }
*
*/
public Object getRef() {
return ref;
}
/**
* Sets the value of the ref property.
*
* @param value
* allowed object is
* {@link Object }
*
*/
public void setRef(Object value) {
this.ref = value;
}
/**
* Copies all values of property {@code HasWallOpening} deeply.
*
* @param source
* The source to copy from.
* @param target
* The target to copy {@code source} to.
* @throws NullPointerException
* if {@code target} is {@code null}.
*/
private static void copyHasWallOpening(final List<WallOpening> source, final List<WallOpening> target) {
// CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
if ((source!= null)&&(!source.isEmpty())) {
for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
final Object next = it.next();
if (next instanceof WallOpening) {
// CClassInfo: it.polito.elite.dog.core.library.jaxb.WallOpening
target.add(((WallOpening) next).clone());
continue;
}
// Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'HasWallOpening' of class 'it.polito.elite.dog.core.library.jaxb.Wall'."));
}
}
}
/**
* Creates and returns a deep copy of a given object.
*
* @param o
* The instance to copy or {@code null}.
* @return A deep copy of {@code o} or {@code null} if {@code o} is
* {@code null}.
*/
@SuppressWarnings("rawtypes")
private static Object copyOf(final Object o) {
// CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
try {
if (o!= null) {
if (o.getClass().isPrimitive()) {
return o;
}
if (o.getClass().isArray()) {
return copyOfArray(o);
}
// Immutable types.
if (o instanceof Boolean) {
return o;
}
if (o instanceof Byte) {
return o;
}
if (o instanceof Character) {
return o;
}
if (o instanceof Double) {
return o;
}
if (o instanceof Enum) {
return o;
}
if (o instanceof Float) {
return o;
}
if (o instanceof Integer) {
return o;
}
if (o instanceof Long) {
return o;
}
if (o instanceof Short) {
return o;
}
if (o instanceof String) {
return o;
}
if (o instanceof BigDecimal) {
return o;
}
if (o instanceof BigInteger) {
return o;
}
if (o instanceof UUID) {
return o;
}
if (o instanceof QName) {
return o;
}
if (o instanceof Duration) {
return o;
}
if (o instanceof Currency) {
return o;
}
// String based types.
if (o instanceof File) {
return new File(o.toString());
}
if (o instanceof URI) {
return new URI(o.toString());
}
if (o instanceof URL) {
return new URL(o.toString());
}
if (o instanceof MimeType) {
return new MimeType(o.toString());
}
// Cloneable types.
if (o instanceof XMLGregorianCalendar) {
return ((XMLGregorianCalendar) o).clone();
}
if (o instanceof Date) {
return ((Date) o).clone();
}
if (o instanceof Calendar) {
return ((Calendar) o).clone();
}
if (o instanceof TimeZone) {
return ((TimeZone) o).clone();
}
if (o instanceof Locale) {
return ((Locale) o).clone();
}
if (o instanceof Element) {
return ((Element)((Element) o).cloneNode(true));
}
if (o instanceof JAXBElement) {
return copyOf(((JAXBElement) o));
}
try {
return o.getClass().getMethod("clone", ((Class[]) null)).invoke(o, ((Object[]) null));
} catch (NoSuchMethodException e) {
if (o instanceof Serializable) {
return copyOf(((Serializable) o));
}
// Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
} catch (IllegalAccessException e) {
// Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
} catch (InvocationTargetException e) {
// Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
} catch (SecurityException e) {
// Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
} catch (IllegalArgumentException e) {
// Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
} catch (ExceptionInInitializerError e) {
// Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
}
}
return null;
} catch (MalformedURLException e) {
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
} catch (MimeTypeParseException e) {
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
} catch (URISyntaxException e) {
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ o)+"'.")).initCause(e));
}
}
/**
* Creates and returns a deep copy of a given array.
*
* @param array
* The array to copy or {@code null}.
* @return
* A deep copy of {@code array} or {@code null} if {@code array} is {@code null}.
*/
private static Object copyOfArray(final Object array) {
// CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
if (array!= null) {
if (array.getClass() == boolean[].class) {
return ((((boolean[]) array) == null)?null:Arrays.copyOf(((boolean[]) array), ((boolean[]) array).length));
}
if (array.getClass() == byte[].class) {
return ((((byte[]) array) == null)?null:Arrays.copyOf(((byte[]) array), ((byte[]) array).length));
}
if (array.getClass() == char[].class) {
return ((((char[]) array) == null)?null:Arrays.copyOf(((char[]) array), ((char[]) array).length));
}
if (array.getClass() == double[].class) {
return ((((double[]) array) == null)?null:Arrays.copyOf(((double[]) array), ((double[]) array).length));
}
if (array.getClass() == float[].class) {
return ((((float[]) array) == null)?null:Arrays.copyOf(((float[]) array), ((float[]) array).length));
}
if (array.getClass() == int[].class) {
return ((((int[]) array) == null)?null:Arrays.copyOf(((int[]) array), ((int[]) array).length));
}
if (array.getClass() == long[].class) {
return ((((long[]) array) == null)?null:Arrays.copyOf(((long[]) array), ((long[]) array).length));
}
if (array.getClass() == short[].class) {
return ((((short[]) array) == null)?null:Arrays.copyOf(((short[]) array), ((short[]) array).length));
}
final int len = Array.getLength(array);
final Object copy = Array.newInstance(array.getClass().getComponentType(), len);
for (int i = (len- 1); (i >= 0); i--) {
Array.set(copy, i, copyOf(Array.get(array, i)));
}
return copy;
}
return null;
}
/**
* Creates and returns a deep copy of a given {@code JAXBElement} instance.
*
* @param element
* The instance to copy or {@code null}.
* @return
* A deep copy of {@code element} or {@code null} if {@code element} is {@code null}.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private static JAXBElement copyOf(final JAXBElement element) {
// CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
if (element!= null) {
final JAXBElement copy = new JAXBElement(element.getName(), element.getDeclaredType(), element.getScope(), element.getValue());
copy.setNil(element.isNil());
copy.setValue(copyOf(copy.getValue()));
return copy;
}
return null;
}
/**
* Creates and returns a deep copy of a given {@code Serializable}.
*
* @param serializable
* The instance to copy or {@code null}.
* @return
* A deep copy of {@code serializable} or {@code null} if {@code serializable} is {@code null}.
*/
private static Serializable copyOf(final Serializable serializable) {
// CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
if (serializable!= null) {
try {
final ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
final ObjectOutputStream out = new ObjectOutputStream(byteArrayOutput);
out.writeObject(serializable);
out.close();
final ByteArrayInputStream byteArrayInput = new ByteArrayInputStream(byteArrayOutput.toByteArray());
final ObjectInputStream in = new ObjectInputStream(byteArrayInput);
final Serializable copy = ((Serializable) in.readObject());
in.close();
return copy;
} catch (SecurityException e) {
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
} catch (ClassNotFoundException e) {
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
} catch (InvalidClassException e) {
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
} catch (NotSerializableException e) {
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
} catch (StreamCorruptedException e) {
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
} catch (OptionalDataException e) {
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
} catch (IOException e) {
throw((AssertionError) new AssertionError((("Unexpected instance during copying object '"+ serializable)+"'.")).initCause(e));
}
}
return null;
}
/**
* Creates and returns a deep copy of this object.
*
*
* @return
* A deep copy of this object.
*/
@Override
public Wall clone() {
try {
{
// CC-XJC Version 2.0.1 Build 2012-03-02T12:09:12+0000
final Wall clone = ((Wall) super.clone());
// 'HasWallOpening' collection.
if (this.hasWallOpening!= null) {
clone.hasWallOpening = null;
copyHasWallOpening(this.getHasWallOpening(), clone.getHasWallOpening());
}
// CBuiltinLeafInfo: java.lang.String
clone.id = ((this.id == null)?null:this.getId());
// CBuiltinLeafInfo: java.lang.String
clone.length = ((this.length == null)?null:this.getLength());
// CBuiltinLeafInfo: java.lang.String
clone.height = ((this.height == null)?null:this.getHeight());
// CBuiltinLeafInfo: java.lang.String
clone.clazz = ((this.clazz == null)?null:this.getClazz());
// CBuiltinLeafInfo: java.lang.Object
clone.ref = ((this.ref == null)?null:copyOf(this.getRef()));
return clone;
}
} catch (CloneNotSupportedException e) {
// Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
throw new AssertionError(e);
}
}
}