org.hl7.fhir.Substance Maven / Gradle / Ivy
Show all versions of quick Show documentation
//
// This file was generated by the Eclipse Implementation of JAXB, v3.0.2
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2024.08.16 at 09:36:55 AM MDT
//
package org.hl7.fhir;
import java.util.ArrayList;
import java.util.Collection;
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.jvnet.jaxb2_commons.lang.Equals2;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy2;
import org.jvnet.jaxb2_commons.lang.HashCode2;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy2;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString2;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy2;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
/**
* If the element is present, it must have either a @value, an @id, or extensions
*
* Java class for Substance complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType name="Substance">
* <complexContent>
* <extension base="{http://hl7.org/fhir}DomainResource">
* <sequence>
* <element name="identifier" type="{http://hl7.org/fhir}Identifier" maxOccurs="unbounded" minOccurs="0"/>
* <element name="category" type="{http://hl7.org/fhir}CodeableConcept" maxOccurs="unbounded" minOccurs="0"/>
* <element name="code" type="{http://hl7.org/fhir}CodeableConcept"/>
* <element name="description" type="{http://hl7.org/fhir}string" minOccurs="0"/>
* <element name="instance" type="{http://hl7.org/fhir}Substance.Instance" maxOccurs="unbounded" minOccurs="0"/>
* <element name="ingredient" type="{http://hl7.org/fhir}Substance.Ingredient" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Substance", propOrder = {
"identifier",
"category",
"code",
"description",
"instance",
"ingredient"
})
public class Substance
extends DomainResource
implements Equals2, HashCode2, ToString2
{
protected List identifier;
protected List category;
@XmlElement(required = true)
protected CodeableConcept code;
protected org.hl7.fhir.String description;
protected List instance;
protected List ingredient;
/**
* Gets the value of the identifier 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 Jakarta XML Binding object.
* This is why there is not a set
method for the identifier property.
*
*
* For example, to add a new item, do as follows:
*
* getIdentifier().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link Identifier }
*
*
*/
public List getIdentifier() {
if (identifier == null) {
identifier = new ArrayList();
}
return this.identifier;
}
/**
* Gets the value of the category 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 Jakarta XML Binding object.
* This is why there is not a set
method for the category property.
*
*
* For example, to add a new item, do as follows:
*
* getCategory().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link CodeableConcept }
*
*
*/
public List getCategory() {
if (category == null) {
category = new ArrayList();
}
return this.category;
}
/**
* Gets the value of the code property.
*
* @return
* possible object is
* {@link CodeableConcept }
*
*/
public CodeableConcept getCode() {
return code;
}
/**
* Sets the value of the code property.
*
* @param value
* allowed object is
* {@link CodeableConcept }
*
*/
public void setCode(CodeableConcept value) {
this.code = value;
}
/**
* Gets the value of the description property.
*
* @return
* possible object is
* {@link org.hl7.fhir.String }
*
*/
public org.hl7.fhir.String getDescription() {
return description;
}
/**
* Sets the value of the description property.
*
* @param value
* allowed object is
* {@link org.hl7.fhir.String }
*
*/
public void setDescription(org.hl7.fhir.String value) {
this.description = value;
}
/**
* Gets the value of the instance 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 Jakarta XML Binding object.
* This is why there is not a set
method for the instance property.
*
*
* For example, to add a new item, do as follows:
*
* getInstance().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link SubstanceInstance }
*
*
*/
public List getInstance() {
if (instance == null) {
instance = new ArrayList();
}
return this.instance;
}
/**
* Gets the value of the ingredient 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 Jakarta XML Binding object.
* This is why there is not a set
method for the ingredient property.
*
*
* For example, to add a new item, do as follows:
*
* getIngredient().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link SubstanceIngredient }
*
*
*/
public List getIngredient() {
if (ingredient == null) {
ingredient = new ArrayList();
}
return this.ingredient;
}
public Substance withIdentifier(Identifier... values) {
if (values!= null) {
for (Identifier value: values) {
getIdentifier().add(value);
}
}
return this;
}
public Substance withIdentifier(Collection values) {
if (values!= null) {
getIdentifier().addAll(values);
}
return this;
}
public Substance withCategory(CodeableConcept... values) {
if (values!= null) {
for (CodeableConcept value: values) {
getCategory().add(value);
}
}
return this;
}
public Substance withCategory(Collection values) {
if (values!= null) {
getCategory().addAll(values);
}
return this;
}
public Substance withCode(CodeableConcept value) {
setCode(value);
return this;
}
public Substance withDescription(org.hl7.fhir.String value) {
setDescription(value);
return this;
}
public Substance withInstance(SubstanceInstance... values) {
if (values!= null) {
for (SubstanceInstance value: values) {
getInstance().add(value);
}
}
return this;
}
public Substance withInstance(Collection values) {
if (values!= null) {
getInstance().addAll(values);
}
return this;
}
public Substance withIngredient(SubstanceIngredient... values) {
if (values!= null) {
for (SubstanceIngredient value: values) {
getIngredient().add(value);
}
}
return this;
}
public Substance withIngredient(Collection values) {
if (values!= null) {
getIngredient().addAll(values);
}
return this;
}
@Override
public Substance withText(Narrative value) {
setText(value);
return this;
}
@Override
public Substance withContained(ResourceContainer... values) {
if (values!= null) {
for (ResourceContainer value: values) {
getContained().add(value);
}
}
return this;
}
@Override
public Substance withContained(Collection values) {
if (values!= null) {
getContained().addAll(values);
}
return this;
}
@Override
public Substance withExtension(Extension... values) {
if (values!= null) {
for (Extension value: values) {
getExtension().add(value);
}
}
return this;
}
@Override
public Substance withExtension(Collection values) {
if (values!= null) {
getExtension().addAll(values);
}
return this;
}
@Override
public Substance withModifierExtension(Extension... values) {
if (values!= null) {
for (Extension value: values) {
getModifierExtension().add(value);
}
}
return this;
}
@Override
public Substance withModifierExtension(Collection values) {
if (values!= null) {
getModifierExtension().addAll(values);
}
return this;
}
@Override
public Substance withId(Id value) {
setId(value);
return this;
}
@Override
public Substance withMeta(Meta value) {
setMeta(value);
return this;
}
@Override
public Substance withImplicitRules(Uri value) {
setImplicitRules(value);
return this;
}
@Override
public Substance withLanguage(Code value) {
setLanguage(value);
return this;
}
@Override
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy2 strategy) {
if ((object == null)||(this.getClass()!= object.getClass())) {
return false;
}
if (this == object) {
return true;
}
if (!super.equals(thisLocator, thatLocator, object, strategy)) {
return false;
}
final Substance that = ((Substance) object);
{
List lhsIdentifier;
lhsIdentifier = (((this.identifier!= null)&&(!this.identifier.isEmpty()))?this.getIdentifier():null);
List rhsIdentifier;
rhsIdentifier = (((that.identifier!= null)&&(!that.identifier.isEmpty()))?that.getIdentifier():null);
if (!strategy.equals(LocatorUtils.property(thisLocator, "identifier", lhsIdentifier), LocatorUtils.property(thatLocator, "identifier", rhsIdentifier), lhsIdentifier, rhsIdentifier, ((this.identifier!= null)&&(!this.identifier.isEmpty())), ((that.identifier!= null)&&(!that.identifier.isEmpty())))) {
return false;
}
}
{
List lhsCategory;
lhsCategory = (((this.category!= null)&&(!this.category.isEmpty()))?this.getCategory():null);
List rhsCategory;
rhsCategory = (((that.category!= null)&&(!that.category.isEmpty()))?that.getCategory():null);
if (!strategy.equals(LocatorUtils.property(thisLocator, "category", lhsCategory), LocatorUtils.property(thatLocator, "category", rhsCategory), lhsCategory, rhsCategory, ((this.category!= null)&&(!this.category.isEmpty())), ((that.category!= null)&&(!that.category.isEmpty())))) {
return false;
}
}
{
CodeableConcept lhsCode;
lhsCode = this.getCode();
CodeableConcept rhsCode;
rhsCode = that.getCode();
if (!strategy.equals(LocatorUtils.property(thisLocator, "code", lhsCode), LocatorUtils.property(thatLocator, "code", rhsCode), lhsCode, rhsCode, (this.code!= null), (that.code!= null))) {
return false;
}
}
{
org.hl7.fhir.String lhsDescription;
lhsDescription = this.getDescription();
org.hl7.fhir.String rhsDescription;
rhsDescription = that.getDescription();
if (!strategy.equals(LocatorUtils.property(thisLocator, "description", lhsDescription), LocatorUtils.property(thatLocator, "description", rhsDescription), lhsDescription, rhsDescription, (this.description!= null), (that.description!= null))) {
return false;
}
}
{
List lhsInstance;
lhsInstance = (((this.instance!= null)&&(!this.instance.isEmpty()))?this.getInstance():null);
List rhsInstance;
rhsInstance = (((that.instance!= null)&&(!that.instance.isEmpty()))?that.getInstance():null);
if (!strategy.equals(LocatorUtils.property(thisLocator, "instance", lhsInstance), LocatorUtils.property(thatLocator, "instance", rhsInstance), lhsInstance, rhsInstance, ((this.instance!= null)&&(!this.instance.isEmpty())), ((that.instance!= null)&&(!that.instance.isEmpty())))) {
return false;
}
}
{
List lhsIngredient;
lhsIngredient = (((this.ingredient!= null)&&(!this.ingredient.isEmpty()))?this.getIngredient():null);
List rhsIngredient;
rhsIngredient = (((that.ingredient!= null)&&(!that.ingredient.isEmpty()))?that.getIngredient():null);
if (!strategy.equals(LocatorUtils.property(thisLocator, "ingredient", lhsIngredient), LocatorUtils.property(thatLocator, "ingredient", rhsIngredient), lhsIngredient, rhsIngredient, ((this.ingredient!= null)&&(!this.ingredient.isEmpty())), ((that.ingredient!= null)&&(!that.ingredient.isEmpty())))) {
return false;
}
}
return true;
}
@Override
public boolean equals(Object object) {
final EqualsStrategy2 strategy = JAXBEqualsStrategy.getInstance();
return equals(null, null, object, strategy);
}
@Override
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) {
int currentHashCode = super.hashCode(locator, strategy);
{
List theIdentifier;
theIdentifier = (((this.identifier!= null)&&(!this.identifier.isEmpty()))?this.getIdentifier():null);
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "identifier", theIdentifier), currentHashCode, theIdentifier, ((this.identifier!= null)&&(!this.identifier.isEmpty())));
}
{
List theCategory;
theCategory = (((this.category!= null)&&(!this.category.isEmpty()))?this.getCategory():null);
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "category", theCategory), currentHashCode, theCategory, ((this.category!= null)&&(!this.category.isEmpty())));
}
{
CodeableConcept theCode;
theCode = this.getCode();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "code", theCode), currentHashCode, theCode, (this.code!= null));
}
{
org.hl7.fhir.String theDescription;
theDescription = this.getDescription();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "description", theDescription), currentHashCode, theDescription, (this.description!= null));
}
{
List theInstance;
theInstance = (((this.instance!= null)&&(!this.instance.isEmpty()))?this.getInstance():null);
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "instance", theInstance), currentHashCode, theInstance, ((this.instance!= null)&&(!this.instance.isEmpty())));
}
{
List theIngredient;
theIngredient = (((this.ingredient!= null)&&(!this.ingredient.isEmpty()))?this.getIngredient():null);
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "ingredient", theIngredient), currentHashCode, theIngredient, ((this.ingredient!= null)&&(!this.ingredient.isEmpty())));
}
return currentHashCode;
}
@Override
public int hashCode() {
final HashCodeStrategy2 strategy = JAXBHashCodeStrategy.getInstance();
return this.hashCode(null, strategy);
}
@Override
public java.lang.String toString() {
final ToStringStrategy2 strategy = JAXBToStringStrategy.getInstance();
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
@Override
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 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, ToStringStrategy2 strategy) {
super.appendFields(locator, buffer, strategy);
{
List theIdentifier;
theIdentifier = (((this.identifier!= null)&&(!this.identifier.isEmpty()))?this.getIdentifier():null);
strategy.appendField(locator, this, "identifier", buffer, theIdentifier, ((this.identifier!= null)&&(!this.identifier.isEmpty())));
}
{
List theCategory;
theCategory = (((this.category!= null)&&(!this.category.isEmpty()))?this.getCategory():null);
strategy.appendField(locator, this, "category", buffer, theCategory, ((this.category!= null)&&(!this.category.isEmpty())));
}
{
CodeableConcept theCode;
theCode = this.getCode();
strategy.appendField(locator, this, "code", buffer, theCode, (this.code!= null));
}
{
org.hl7.fhir.String theDescription;
theDescription = this.getDescription();
strategy.appendField(locator, this, "description", buffer, theDescription, (this.description!= null));
}
{
List theInstance;
theInstance = (((this.instance!= null)&&(!this.instance.isEmpty()))?this.getInstance():null);
strategy.appendField(locator, this, "instance", buffer, theInstance, ((this.instance!= null)&&(!this.instance.isEmpty())));
}
{
List theIngredient;
theIngredient = (((this.ingredient!= null)&&(!this.ingredient.isEmpty()))?this.getIngredient():null);
strategy.appendField(locator, this, "ingredient", buffer, theIngredient, ((this.ingredient!= null)&&(!this.ingredient.isEmpty())));
}
return buffer;
}
public void setIdentifier(List value) {
this.identifier = value;
}
public void setCategory(List value) {
this.category = value;
}
public void setInstance(List value) {
this.instance = value;
}
public void setIngredient(List value) {
this.ingredient = value;
}
}