extension.biceps.MyDescriptorExtension Maven / Gradle / Ivy
Show all versions of glue-examples Show documentation
package extension.biceps;
import java.util.HashMap;
import java.util.Map;
import javax.xml.namespace.QName;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAnyAttribute;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlType;
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.participant.CodedValue;
/**
* Java class for anonymous complex type
.
*
* The following schema fragment specifies the expected content contained within this class.
*
* {@code
*
*
*
*
*
*
*
*
*
*
*
* }
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"keyType"
})
@XmlRootElement(name = "MyDescriptorExtension", namespace = "http://biceps.extension")
public class MyDescriptorExtension implements Cloneable, CopyTo, ToString
{
@XmlElement(name = "KeyType", namespace = "http://biceps.extension", required = true)
protected CodedValue keyType;
@XmlAttribute(name = "Value", required = true)
protected String value;
@XmlAnyAttribute
private Map otherAttributes = new HashMap<>();
/**
* Gets the value of the keyType property.
*
* @return
* possible object is
* {@link CodedValue }
*
*/
public CodedValue getKeyType() {
return keyType;
}
/**
* Sets the value of the keyType property.
*
* @param value
* allowed object is
* {@link CodedValue }
*
*/
public void setKeyType(CodedValue value) {
this.keyType = value;
}
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
*
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map getOtherAttributes() {
return otherAttributes;
}
@Override
public boolean equals(Object object) {
if ((object == null)||(this.getClass()!= object.getClass())) {
return false;
}
if (this == object) {
return true;
}
final MyDescriptorExtension that = ((MyDescriptorExtension) object);
{
CodedValue leftKeyType;
leftKeyType = this.getKeyType();
CodedValue rightKeyType;
rightKeyType = that.getKeyType();
if (this.keyType!= null) {
if (that.keyType!= null) {
if (!leftKeyType.equals(rightKeyType)) {
return false;
}
} else {
return false;
}
} else {
if (that.keyType!= null) {
return false;
}
}
}
{
String leftValue;
leftValue = this.getValue();
String rightValue;
rightValue = that.getValue();
if (this.value!= null) {
if (that.value!= null) {
if (!leftValue.equals(rightValue)) {
return false;
}
} else {
return false;
}
} else {
if (that.value!= null) {
return false;
}
}
}
return true;
}
@Override
public int hashCode() {
int currentHashCode = 1;
{
currentHashCode = (currentHashCode* 31);
CodedValue theKeyType;
theKeyType = this.getKeyType();
if (this.keyType!= null) {
currentHashCode += theKeyType.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
String theValue;
theValue = this.getValue();
if (this.value!= null) {
currentHashCode += theValue.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) {
{
CodedValue theKeyType;
theKeyType = this.getKeyType();
strategy.appendField(locator, this, "keyType", buffer, theKeyType, (this.keyType!= null));
}
{
String theValue;
theValue = this.getValue();
strategy.appendField(locator, this, "value", buffer, theValue, (this.value!= 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 MyDescriptorExtension) {
final MyDescriptorExtension copy = ((MyDescriptorExtension) draftCopy);
{
Boolean keyTypeShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.keyType!= null));
if (keyTypeShouldBeCopiedAndSet == Boolean.TRUE) {
CodedValue sourceKeyType;
sourceKeyType = this.getKeyType();
CodedValue copyKeyType = ((CodedValue) strategy.copy(LocatorUtils.property(locator, "keyType", sourceKeyType), sourceKeyType, (this.keyType!= null)));
copy.setKeyType(copyKeyType);
} else {
if (keyTypeShouldBeCopiedAndSet == Boolean.FALSE) {
copy.keyType = null;
}
}
}
{
Boolean valueShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.value!= null));
if (valueShouldBeCopiedAndSet == Boolean.TRUE) {
String sourceValue;
sourceValue = this.getValue();
String copyValue = ((String) strategy.copy(LocatorUtils.property(locator, "value", sourceValue), sourceValue, (this.value!= null)));
copy.setValue(copyValue);
} else {
if (valueShouldBeCopiedAndSet == Boolean.FALSE) {
copy.value = null;
}
}
}
}
return draftCopy;
}
@Override
public Object createNewInstance() {
return new MyDescriptorExtension();
}
}