org.somda.sdc.biceps.model.participant.PersonParticipation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of biceps-model Show documentation
Show all versions of biceps-model Show documentation
SDCri is a set of Java libraries that implements a network communication framework conforming
with the IEEE 11073 SDC specifications. This project implements the model for
IEEE 11073-10207.
The newest version!
package org.somda.sdc.biceps.model.participant;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import org.jetbrains.annotations.Nullable;
import org.jvnet.jaxb.lang.CopyStrategy;
import org.jvnet.jaxb.lang.CopyTo;
import org.jvnet.jaxb.lang.JAXBCopyStrategy;
import org.jvnet.jaxb.lang.JAXBToStringStrategy;
import org.jvnet.jaxb.lang.ToString;
import org.jvnet.jaxb.lang.ToStringStrategy;
import org.jvnet.jaxb.locator.ObjectLocator;
import org.jvnet.jaxb.locator.util.LocatorUtils;
/**
* A reference to an identifiable person with a name that participates in a role.
*
* Java class for PersonParticipation complex type
.
*
* The following schema fragment specifies the expected content contained within this class.
*
* {@code
*
*
*
*
*
*
*
*
*
* }
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PersonParticipation", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/participant", propOrder = {
"role"
})
public class PersonParticipation
extends PersonReference
implements Cloneable, CopyTo, ToString
{
/**
* Roles the referenced person acts in the relationship.
*
*/
@XmlElement(name = "Role", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/participant")
protected List role;
/**
* Roles the referenced person acts in the relationship.
*
* Gets the value of the role 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 role property.
*
*
* For example, to add a new item, do as follows:
*
*
* getRole().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link CodedValue }
*
*
*
* @return
* The value of the role property.
*/
public List getRole() {
if (role == null) {
role = new ArrayList<>();
}
return this.role;
}
public void setRole(
@Nullable
List value) {
this.role = null;
if (value!= null) {
List draftl = this.getRole();
draftl.addAll(value);
}
}
@Override
public boolean equals(Object object) {
if ((object == null)||(this.getClass()!= object.getClass())) {
return false;
}
if (this == object) {
return true;
}
if (!super.equals(object)) {
return false;
}
final PersonParticipation that = ((PersonParticipation) object);
{
List leftRole;
leftRole = (((this.role!= null)&&(!this.role.isEmpty()))?this.getRole():null);
List rightRole;
rightRole = (((that.role!= null)&&(!that.role.isEmpty()))?that.getRole():null);
if ((this.role!= null)&&(!this.role.isEmpty())) {
if ((that.role!= null)&&(!that.role.isEmpty())) {
if (!leftRole.equals(rightRole)) {
return false;
}
} else {
return false;
}
} else {
if ((that.role!= null)&&(!that.role.isEmpty())) {
return false;
}
}
}
return true;
}
@Override
public int hashCode() {
int currentHashCode = 1;
currentHashCode = ((currentHashCode* 31)+ super.hashCode());
{
currentHashCode = (currentHashCode* 31);
List theRole;
theRole = (((this.role!= null)&&(!this.role.isEmpty()))?this.getRole():null);
if ((this.role!= null)&&(!this.role.isEmpty())) {
currentHashCode += theRole.hashCode();
}
}
return currentHashCode;
}
@Override
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.getInstance();
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
@Override
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
@Override
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
super.appendFields(locator, buffer, strategy);
{
List theRole;
theRole = (((this.role!= null)&&(!this.role.isEmpty()))?this.getRole():null);
strategy.appendField(locator, this, "role", buffer, theRole, ((this.role!= null)&&(!this.role.isEmpty())));
}
return buffer;
}
@Override
public Object clone() {
return copyTo(createNewInstance());
}
@Override
public Object copyTo(Object target) {
final CopyStrategy strategy = JAXBCopyStrategy.getInstance();
return copyTo(null, target, strategy);
}
@Override
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy strategy) {
final Object draftCopy = ((target == null)?createNewInstance():target);
super.copyTo(locator, draftCopy, strategy);
if (draftCopy instanceof PersonParticipation) {
final PersonParticipation copy = ((PersonParticipation) draftCopy);
{
Boolean roleShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.role!= null)&&(!this.role.isEmpty())));
if (roleShouldBeCopiedAndSet == Boolean.TRUE) {
List sourceRole;
sourceRole = (((this.role!= null)&&(!this.role.isEmpty()))?this.getRole():null);
@SuppressWarnings("unchecked")
List copyRole = ((List ) strategy.copy(LocatorUtils.property(locator, "role", sourceRole), sourceRole, ((this.role!= null)&&(!this.role.isEmpty()))));
copy.setRole(copyRole);
} else {
if (roleShouldBeCopiedAndSet == Boolean.FALSE) {
copy.role = null;
}
}
}
}
return draftCopy;
}
@Override
public Object createNewInstance() {
return new PersonParticipation();
}
}