All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.somda.sdc.biceps.model.participant.LocalizedText Maven / Gradle / Ivy


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.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.XmlValue;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
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;


/**
 * LocalizedText is a bundled ELEMENT to reference texts in different languages or to provide a text in a specific language.
 * 
 * The goal of text references is to shrink the overall size of the MDIB by only providing a single reference to a text file that translates a text into multiple languages instead of flooding the MDIB with all translated texts. Referenced texts can be requested by the LOCALIZATION SERVICE. If no LOCALIZATION SERVICE exist, the application can make use of LocalizedText to represent a text in a single language.
 * 
 * __R5047: If ./@Lang and ./@Ref are present, then the text SHALL be only available in the language specified by ./@Lang.__
 * 
 * __R5048: If ./@Lang is present and ./@Ref is not present, then ./@Lang SHALL specify the language of the LocalizedText's content. The Text is not available through the LOCALIZATION SERVICE.__
 * 
 * __R5049: If ./@Lang is not present and ./@Ref is present, then the text SHALL be available through the LOCALIZATION SERVICE.__
 * 
 * __R5050: If ./@Lang and ./@Ref are not present, then the language of the LocalizedText's content is unknown. The text SHALL NOT be available through the LOCALIZATION SERVICE.__
 * 
 * 

Java class for LocalizedText complex type

. * *

The following schema fragment specifies the expected content contained within this class.

* *
{@code
 * 
 *   
 *     
 *       
 *       
 *       
 *       
 *     
 *   
 * 
 * }
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "LocalizedText", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/participant", propOrder = { "value" }) public class LocalizedText implements Cloneable, CopyTo, ToString { /** * Content restriction for pm:LocalizedText ELEMENTs. * */ @XmlValue protected String value; /** * References a text in a localized text file. * * Text references SHALL be unique regardless of any HANDLE name. * */ @XmlAttribute(name = "Ref") protected String ref; /** * Lang specifies the language of the localized text. * */ @XmlAttribute(name = "Lang") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlSchemaType(name = "language") protected String lang; /** * Version defines the current revision of the referenced text in the localized text file. * * __R5006: Texts might change over time, but references are per definition unique and typically do not change. To check if a text that is referenced by ./@Ref has changed, pm:LocalizedText SHALL include Version if ./@Ref is set. * * NOTE—This saves to query a localized text file if the referencing ELEMENT has changed, but the referenced text has not. If Version is not given, a client has to assume that the text changes every time the referencing ELEMENT changes. In this case, the client is encouraged to query the localized text file on each modification.__ * * __R5007: To keep things simple, every translated text in a localized text file that belongs to a particular reference SHALL share the same version number.__ * * NOTE—From this it follows that if Version has changed, every translation of a referenced text is obsolete even if only a single translation has changed. * */ @XmlAttribute(name = "Version") protected BigInteger version; /** * Text width as defined in pm:LocalizedTextWidth. * */ @XmlAttribute(name = "TextWidth") protected LocalizedTextWidth textWidth; /** * Content restriction for pm:LocalizedText ELEMENTs. * * @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 } * * @see #getValue() */ public void setValue(String value) { this.value = value; } /** * References a text in a localized text file. * * Text references SHALL be unique regardless of any HANDLE name. * * @return * possible object is * {@link String } * */ @Nullable public String getRef() { return ref; } /** * Sets the value of the ref property. * * @param value * allowed object is * {@link String } * * @see #getRef() */ public void setRef( @Nullable String value) { this.ref = value; } /** * Lang specifies the language of the localized text. * * @return * possible object is * {@link String } * */ @Nullable public String getLang() { return lang; } /** * Sets the value of the lang property. * * @param value * allowed object is * {@link String } * * @see #getLang() */ public void setLang( @Nullable String value) { this.lang = value; } /** * Version defines the current revision of the referenced text in the localized text file. * * __R5006: Texts might change over time, but references are per definition unique and typically do not change. To check if a text that is referenced by ./@Ref has changed, pm:LocalizedText SHALL include Version if ./@Ref is set. * * NOTE—This saves to query a localized text file if the referencing ELEMENT has changed, but the referenced text has not. If Version is not given, a client has to assume that the text changes every time the referencing ELEMENT changes. In this case, the client is encouraged to query the localized text file on each modification.__ * * __R5007: To keep things simple, every translated text in a localized text file that belongs to a particular reference SHALL share the same version number.__ * * NOTE—From this it follows that if Version has changed, every translation of a referenced text is obsolete even if only a single translation has changed. * * @return * possible object is * {@link BigInteger } * */ @Nullable public BigInteger getVersion() { return version; } /** * Sets the value of the version property. * * @param value * allowed object is * {@link BigInteger } * * @see #getVersion() */ public void setVersion( @Nullable BigInteger value) { this.version = value; } /** * Text width as defined in pm:LocalizedTextWidth. * * @return * possible object is * {@link LocalizedTextWidth } * */ @Nullable public LocalizedTextWidth getTextWidth() { return textWidth; } /** * Sets the value of the textWidth property. * * @param value * allowed object is * {@link LocalizedTextWidth } * * @see #getTextWidth() */ public void setTextWidth( @Nullable LocalizedTextWidth value) { this.textWidth = value; } @Override public boolean equals(Object object) { if ((object == null)||(this.getClass()!= object.getClass())) { return false; } if (this == object) { return true; } final LocalizedText that = ((LocalizedText) object); { 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; } } } { String leftRef; leftRef = this.getRef(); String rightRef; rightRef = that.getRef(); if (this.ref!= null) { if (that.ref!= null) { if (!leftRef.equals(rightRef)) { return false; } } else { return false; } } else { if (that.ref!= null) { return false; } } } { String leftLang; leftLang = this.getLang(); String rightLang; rightLang = that.getLang(); if (this.lang!= null) { if (that.lang!= null) { if (!leftLang.equals(rightLang)) { return false; } } else { return false; } } else { if (that.lang!= null) { return false; } } } { BigInteger leftVersion; leftVersion = this.getVersion(); BigInteger rightVersion; rightVersion = that.getVersion(); if (this.version!= null) { if (that.version!= null) { if (!leftVersion.equals(rightVersion)) { return false; } } else { return false; } } else { if (that.version!= null) { return false; } } } { LocalizedTextWidth leftTextWidth; leftTextWidth = this.getTextWidth(); LocalizedTextWidth rightTextWidth; rightTextWidth = that.getTextWidth(); if (this.textWidth!= null) { if (that.textWidth!= null) { if (!leftTextWidth.equals(rightTextWidth)) { return false; } } else { return false; } } else { if (that.textWidth!= null) { return false; } } } return true; } @Override public int hashCode() { int currentHashCode = 1; { currentHashCode = (currentHashCode* 31); String theValue; theValue = this.getValue(); if (this.value!= null) { currentHashCode += theValue.hashCode(); } } { currentHashCode = (currentHashCode* 31); String theRef; theRef = this.getRef(); if (this.ref!= null) { currentHashCode += theRef.hashCode(); } } { currentHashCode = (currentHashCode* 31); String theLang; theLang = this.getLang(); if (this.lang!= null) { currentHashCode += theLang.hashCode(); } } { currentHashCode = (currentHashCode* 31); BigInteger theVersion; theVersion = this.getVersion(); if (this.version!= null) { currentHashCode += theVersion.hashCode(); } } { currentHashCode = (currentHashCode* 31); LocalizedTextWidth theTextWidth; theTextWidth = this.getTextWidth(); if (this.textWidth!= null) { currentHashCode += theTextWidth.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) { { String theValue; theValue = this.getValue(); strategy.appendField(locator, this, "value", buffer, theValue, (this.value!= null)); } { String theRef; theRef = this.getRef(); strategy.appendField(locator, this, "ref", buffer, theRef, (this.ref!= null)); } { String theLang; theLang = this.getLang(); strategy.appendField(locator, this, "lang", buffer, theLang, (this.lang!= null)); } { BigInteger theVersion; theVersion = this.getVersion(); strategy.appendField(locator, this, "version", buffer, theVersion, (this.version!= null)); } { LocalizedTextWidth theTextWidth; theTextWidth = this.getTextWidth(); strategy.appendField(locator, this, "textWidth", buffer, theTextWidth, (this.textWidth!= 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 LocalizedText) { final LocalizedText copy = ((LocalizedText) draftCopy); { 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; } } } { Boolean refShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.ref!= null)); if (refShouldBeCopiedAndSet == Boolean.TRUE) { String sourceRef; sourceRef = this.getRef(); String copyRef = ((String) strategy.copy(LocatorUtils.property(locator, "ref", sourceRef), sourceRef, (this.ref!= null))); copy.setRef(copyRef); } else { if (refShouldBeCopiedAndSet == Boolean.FALSE) { copy.ref = null; } } } { Boolean langShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.lang!= null)); if (langShouldBeCopiedAndSet == Boolean.TRUE) { String sourceLang; sourceLang = this.getLang(); String copyLang = ((String) strategy.copy(LocatorUtils.property(locator, "lang", sourceLang), sourceLang, (this.lang!= null))); copy.setLang(copyLang); } else { if (langShouldBeCopiedAndSet == Boolean.FALSE) { copy.lang = null; } } } { Boolean versionShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.version!= null)); if (versionShouldBeCopiedAndSet == Boolean.TRUE) { BigInteger sourceVersion; sourceVersion = this.getVersion(); BigInteger copyVersion = ((BigInteger) strategy.copy(LocatorUtils.property(locator, "version", sourceVersion), sourceVersion, (this.version!= null))); copy.setVersion(copyVersion); } else { if (versionShouldBeCopiedAndSet == Boolean.FALSE) { copy.version = null; } } } { Boolean textWidthShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.textWidth!= null)); if (textWidthShouldBeCopiedAndSet == Boolean.TRUE) { LocalizedTextWidth sourceTextWidth; sourceTextWidth = this.getTextWidth(); LocalizedTextWidth copyTextWidth = ((LocalizedTextWidth) strategy.copy(LocatorUtils.property(locator, "textWidth", sourceTextWidth), sourceTextWidth, (this.textWidth!= null))); copy.setTextWidth(copyTextWidth); } else { if (textWidthShouldBeCopiedAndSet == Boolean.FALSE) { copy.textWidth = null; } } } } return draftCopy; } @Override public Object createNewInstance() { return new LocalizedText(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy