com.helger.genericode.v04.SimpleCodeList Maven / Gradle / Ivy
Show all versions of ph-genericode Show documentation
package com.helger.genericode.v04;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.helger.commons.annotation.CodingStyleguideUnaware;
import com.helger.commons.annotation.ReturnsMutableCopy;
import com.helger.commons.annotation.ReturnsMutableObject;
import com.helger.commons.equals.EqualsHelper;
import com.helger.commons.hashcode.HashCodeGenerator;
import com.helger.commons.string.ToStringGenerator;
/**
* Definition of a simple code list.
*
* Java class for SimpleCodeList complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType name="SimpleCodeList">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Annotation" type="{http://genericode.org/2006/ns/CodeList/0.4/}Annotation" minOccurs="0"/>
* <element name="Row" type="{http://genericode.org/2006/ns/CodeList/0.4/}Row" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
*
* This class was annotated by ph-jaxb22-plugin -Xph-annotate
* This class contains methods created by ph-jaxb22-plugin -Xph-equalshashcode
* This class contains methods created by ph-jaxb22-plugin -Xph-tostring
* This class contains methods created by ph-jaxb22-plugin -Xph-list-extension
* This class contains methods created by ph-jaxb22-plugin -Xph-cloneable
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SimpleCodeList", propOrder = {
"annotation",
"row"
})
@CodingStyleguideUnaware
public class SimpleCodeList implements Serializable, Cloneable
{
@XmlElement(name = "Annotation")
private Annotation annotation;
@XmlElement(name = "Row")
private List row;
/**
* Gets the value of the annotation property.
*
* @return
* possible object is
* {@link Annotation }
*
*/
@Nullable
public Annotation getAnnotation() {
return annotation;
}
/**
* Sets the value of the annotation property.
*
* @param value
* allowed object is
* {@link Annotation }
*
*/
public void setAnnotation(
@Nullable
Annotation value) {
this.annotation = value;
}
/**
* Gets the value of the row property.
*
*
* 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 set
method for the row property.
*
*
* For example, to add a new item, do as follows:
*
* getRow().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link Row }
*
*
*/
@Nonnull
@ReturnsMutableObject("JAXB implementation style")
public List getRow() {
if (row == null) {
row = new ArrayList();
}
return this.row;
}
/**
* Created by ph-jaxb22-plugin -Xph-equalshashcode
*
*/
@Override
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if ((o == null)||(!getClass().equals(o.getClass()))) {
return false;
}
final SimpleCodeList rhs = ((SimpleCodeList) o);
if (!EqualsHelper.equals(annotation, rhs.annotation)) {
return false;
}
if (!EqualsHelper.equals(row, rhs.row)) {
return false;
}
return true;
}
/**
* Created by ph-jaxb22-plugin -Xph-equalshashcode
*
*/
@Override
public int hashCode() {
return new HashCodeGenerator(this).append(annotation).append(row).getHashCode();
}
/**
* Created by ph-jaxb22-plugin -Xph-tostring
*
*/
@Override
public String toString() {
return new ToStringGenerator(this).append("annotation", annotation).append("row", row).getToString();
}
/**
* Created by ph-jaxb22-plugin -Xph-list-extension
*
* @param aList
* The new list member to set. May be null
.
*/
public void setRow(
@Nullable
final List aList) {
row = aList;
}
/**
* Created by ph-jaxb22-plugin -Xph-list-extension
*
* @return
* true
if at least one item is contained, false
otherwise.
*/
public boolean hasRowEntries() {
return (!getRow().isEmpty());
}
/**
* Created by ph-jaxb22-plugin -Xph-list-extension
*
* @return
* true
if no item is contained, false
otherwise.
*/
public boolean hasNoRowEntries() {
return getRow().isEmpty();
}
/**
* Created by ph-jaxb22-plugin -Xph-list-extension
*
* @return
* The number of contained elements. Always ≥ 0.
*/
@Nonnegative
public int getRowCount() {
return getRow().size();
}
/**
* Created by ph-jaxb22-plugin -Xph-list-extension
*
* @param index
* The index to retrieve
* @return
* The element at the specified index. May be null
* @throws IndexOutOfBoundsException
* if the index is invalid!
*/
@Nullable
public Row getRowAtIndex(
@Nonnegative
final int index)
throws IndexOutOfBoundsException
{
return getRow().get(index);
}
/**
* Created by ph-jaxb22-plugin -Xph-list-extension
*
* @param elem
* The element to be added. May not be null
.
*/
public void addRow(
@Nonnull
final Row elem) {
getRow().add(elem);
}
/**
* This method clones all values from this
to the passed object. All data in the parameter object is overwritten!Created by ph-jaxb22-plugin -Xph-cloneable
*
* @param ret
* The target object to clone to. May not be null
.
*/
public void cloneTo(
@Nonnull
SimpleCodeList ret) {
ret.annotation = ((annotation == null)?null:annotation.clone());
List retRow = new ArrayList();
for (Row aItem: getRow()) {
retRow.add(((aItem == null)?null:aItem.clone()));
}
ret.row = retRow;
}
/**
* Created by ph-jaxb22-plugin -Xph-cloneable
*
* @return
* The cloned object. Never null
.
*/
@Nonnull
@ReturnsMutableCopy
@Override
public SimpleCodeList clone() {
SimpleCodeList ret = new SimpleCodeList();
cloneTo(ret);
return ret;
}
}