org.somda.sdc.biceps.model.participant.AbstractState 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.math.BigInteger;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlSeeAlso;
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;
import org.somda.sdc.biceps.model.extension.ExtensionType;
/**
* AbstractState defines foundational meta information of any object that is included in the state part of the MDIB. Any state object is derived from pm:AbstractState. The pm:AbstractState's counterpart is pm:AbstractDescriptor.
*
* Java class for AbstractState complex type
.
*
* The following schema fragment specifies the expected content contained within this class.
*
* {@code
*
*
*
*
*
*
*
*
*
*
*
*
* }
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AbstractState", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/participant", propOrder = {
"extension"
})
@XmlSeeAlso({
AbstractAlertState.class,
AbstractMetricState.class,
AbstractOperationState.class,
AbstractDeviceComponentState.class,
AbstractMultiState.class
})
public class AbstractState implements Cloneable, CopyTo, ToString
{
@XmlElement(name = "Extension", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/extension")
protected ExtensionType extension;
/**
* StateVersion is incremented by one with every state modification. The implied value for the initial state instance SHALL be "0".
*
*/
@XmlAttribute(name = "StateVersion")
protected BigInteger stateVersion;
/**
* The HANDLE reference of a descriptor to which the state belongs.
*
*/
@XmlAttribute(name = "DescriptorHandle", required = true)
protected String descriptorHandle;
/**
* The current version of the descriptor to that the state belongs to. The implied value for the initial state instance SHALL be "0".
*
*/
@XmlAttribute(name = "DescriptorVersion")
protected BigInteger descriptorVersion;
/**
* Gets the value of the extension property.
*
* @return
* possible object is
* {@link ExtensionType }
*
*/
@Nullable
public ExtensionType getExtension() {
return extension;
}
/**
* Sets the value of the extension property.
*
* @param value
* allowed object is
* {@link ExtensionType }
*
*/
public void setExtension(
@Nullable
ExtensionType value) {
this.extension = value;
}
/**
* StateVersion is incremented by one with every state modification. The implied value for the initial state instance SHALL be "0".
*
* @return
* possible object is
* {@link BigInteger }
*
*/
@Nullable
public BigInteger getStateVersion() {
return stateVersion;
}
/**
* Sets the value of the stateVersion property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
* @see #getStateVersion()
*/
public void setStateVersion(
@Nullable
BigInteger value) {
this.stateVersion = value;
}
/**
* The HANDLE reference of a descriptor to which the state belongs.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDescriptorHandle() {
return descriptorHandle;
}
/**
* Sets the value of the descriptorHandle property.
*
* @param value
* allowed object is
* {@link String }
*
* @see #getDescriptorHandle()
*/
public void setDescriptorHandle(String value) {
this.descriptorHandle = value;
}
/**
* The current version of the descriptor to that the state belongs to. The implied value for the initial state instance SHALL be "0".
*
* @return
* possible object is
* {@link BigInteger }
*
*/
@Nullable
public BigInteger getDescriptorVersion() {
return descriptorVersion;
}
/**
* Sets the value of the descriptorVersion property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
* @see #getDescriptorVersion()
*/
public void setDescriptorVersion(
@Nullable
BigInteger value) {
this.descriptorVersion = value;
}
@Override
public boolean equals(Object object) {
if ((object == null)||(this.getClass()!= object.getClass())) {
return false;
}
if (this == object) {
return true;
}
final AbstractState that = ((AbstractState) object);
{
ExtensionType leftExtension;
leftExtension = this.getExtension();
ExtensionType rightExtension;
rightExtension = that.getExtension();
if (this.extension!= null) {
if (that.extension!= null) {
if (!leftExtension.equals(rightExtension)) {
return false;
}
} else {
return false;
}
} else {
if (that.extension!= null) {
return false;
}
}
}
{
BigInteger leftStateVersion;
leftStateVersion = this.getStateVersion();
BigInteger rightStateVersion;
rightStateVersion = that.getStateVersion();
if (this.stateVersion!= null) {
if (that.stateVersion!= null) {
if (!leftStateVersion.equals(rightStateVersion)) {
return false;
}
} else {
return false;
}
} else {
if (that.stateVersion!= null) {
return false;
}
}
}
{
String leftDescriptorHandle;
leftDescriptorHandle = this.getDescriptorHandle();
String rightDescriptorHandle;
rightDescriptorHandle = that.getDescriptorHandle();
if (this.descriptorHandle!= null) {
if (that.descriptorHandle!= null) {
if (!leftDescriptorHandle.equals(rightDescriptorHandle)) {
return false;
}
} else {
return false;
}
} else {
if (that.descriptorHandle!= null) {
return false;
}
}
}
{
BigInteger leftDescriptorVersion;
leftDescriptorVersion = this.getDescriptorVersion();
BigInteger rightDescriptorVersion;
rightDescriptorVersion = that.getDescriptorVersion();
if (this.descriptorVersion!= null) {
if (that.descriptorVersion!= null) {
if (!leftDescriptorVersion.equals(rightDescriptorVersion)) {
return false;
}
} else {
return false;
}
} else {
if (that.descriptorVersion!= null) {
return false;
}
}
}
return true;
}
@Override
public int hashCode() {
int currentHashCode = 1;
{
currentHashCode = (currentHashCode* 31);
ExtensionType theExtension;
theExtension = this.getExtension();
if (this.extension!= null) {
currentHashCode += theExtension.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
BigInteger theStateVersion;
theStateVersion = this.getStateVersion();
if (this.stateVersion!= null) {
currentHashCode += theStateVersion.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
String theDescriptorHandle;
theDescriptorHandle = this.getDescriptorHandle();
if (this.descriptorHandle!= null) {
currentHashCode += theDescriptorHandle.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
BigInteger theDescriptorVersion;
theDescriptorVersion = this.getDescriptorVersion();
if (this.descriptorVersion!= null) {
currentHashCode += theDescriptorVersion.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) {
{
ExtensionType theExtension;
theExtension = this.getExtension();
strategy.appendField(locator, this, "extension", buffer, theExtension, (this.extension!= null));
}
{
BigInteger theStateVersion;
theStateVersion = this.getStateVersion();
strategy.appendField(locator, this, "stateVersion", buffer, theStateVersion, (this.stateVersion!= null));
}
{
String theDescriptorHandle;
theDescriptorHandle = this.getDescriptorHandle();
strategy.appendField(locator, this, "descriptorHandle", buffer, theDescriptorHandle, (this.descriptorHandle!= null));
}
{
BigInteger theDescriptorVersion;
theDescriptorVersion = this.getDescriptorVersion();
strategy.appendField(locator, this, "descriptorVersion", buffer, theDescriptorVersion, (this.descriptorVersion!= null));
}
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);
if (draftCopy instanceof AbstractState) {
final AbstractState copy = ((AbstractState) draftCopy);
{
Boolean extensionShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.extension!= null));
if (extensionShouldBeCopiedAndSet == Boolean.TRUE) {
ExtensionType sourceExtension;
sourceExtension = this.getExtension();
ExtensionType copyExtension = ((ExtensionType) strategy.copy(LocatorUtils.property(locator, "extension", sourceExtension), sourceExtension, (this.extension!= null)));
copy.setExtension(copyExtension);
} else {
if (extensionShouldBeCopiedAndSet == Boolean.FALSE) {
copy.extension = null;
}
}
}
{
Boolean stateVersionShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.stateVersion!= null));
if (stateVersionShouldBeCopiedAndSet == Boolean.TRUE) {
BigInteger sourceStateVersion;
sourceStateVersion = this.getStateVersion();
BigInteger copyStateVersion = ((BigInteger) strategy.copy(LocatorUtils.property(locator, "stateVersion", sourceStateVersion), sourceStateVersion, (this.stateVersion!= null)));
copy.setStateVersion(copyStateVersion);
} else {
if (stateVersionShouldBeCopiedAndSet == Boolean.FALSE) {
copy.stateVersion = null;
}
}
}
{
Boolean descriptorHandleShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.descriptorHandle!= null));
if (descriptorHandleShouldBeCopiedAndSet == Boolean.TRUE) {
String sourceDescriptorHandle;
sourceDescriptorHandle = this.getDescriptorHandle();
String copyDescriptorHandle = ((String) strategy.copy(LocatorUtils.property(locator, "descriptorHandle", sourceDescriptorHandle), sourceDescriptorHandle, (this.descriptorHandle!= null)));
copy.setDescriptorHandle(copyDescriptorHandle);
} else {
if (descriptorHandleShouldBeCopiedAndSet == Boolean.FALSE) {
copy.descriptorHandle = null;
}
}
}
{
Boolean descriptorVersionShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.descriptorVersion!= null));
if (descriptorVersionShouldBeCopiedAndSet == Boolean.TRUE) {
BigInteger sourceDescriptorVersion;
sourceDescriptorVersion = this.getDescriptorVersion();
BigInteger copyDescriptorVersion = ((BigInteger) strategy.copy(LocatorUtils.property(locator, "descriptorVersion", sourceDescriptorVersion), sourceDescriptorVersion, (this.descriptorVersion!= null)));
copy.setDescriptorVersion(copyDescriptorVersion);
} else {
if (descriptorVersionShouldBeCopiedAndSet == Boolean.FALSE) {
copy.descriptorVersion = null;
}
}
}
}
return draftCopy;
}
@Override
public Object createNewInstance() {
return new AbstractState();
}
}