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

com.ibm.fhir.model.resource.Substance Maven / Gradle / Ivy

/*
 * (C) Copyright IBM Corp. 2019, 2021
 *
 * SPDX-License-Identifier: Apache-2.0
 */

package com.ibm.fhir.model.resource;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

import javax.annotation.Generated;

import com.ibm.fhir.model.annotation.Binding;
import com.ibm.fhir.model.annotation.Choice;
import com.ibm.fhir.model.annotation.Constraint;
import com.ibm.fhir.model.annotation.Maturity;
import com.ibm.fhir.model.annotation.ReferenceTarget;
import com.ibm.fhir.model.annotation.Required;
import com.ibm.fhir.model.annotation.Summary;
import com.ibm.fhir.model.type.BackboneElement;
import com.ibm.fhir.model.type.Code;
import com.ibm.fhir.model.type.CodeableConcept;
import com.ibm.fhir.model.type.DateTime;
import com.ibm.fhir.model.type.Element;
import com.ibm.fhir.model.type.Extension;
import com.ibm.fhir.model.type.Identifier;
import com.ibm.fhir.model.type.Meta;
import com.ibm.fhir.model.type.Narrative;
import com.ibm.fhir.model.type.Ratio;
import com.ibm.fhir.model.type.Reference;
import com.ibm.fhir.model.type.SimpleQuantity;
import com.ibm.fhir.model.type.String;
import com.ibm.fhir.model.type.Uri;
import com.ibm.fhir.model.type.code.BindingStrength;
import com.ibm.fhir.model.type.code.FHIRSubstanceStatus;
import com.ibm.fhir.model.type.code.StandardsStatus;
import com.ibm.fhir.model.util.ValidationSupport;
import com.ibm.fhir.model.visitor.Visitor;

/**
 * A homogeneous material with a definite composition.
 * 
 * 

Maturity level: FMM2 (Trial Use) */ @Maturity( level = 2, status = StandardsStatus.Value.TRIAL_USE ) @Constraint( id = "substance-0", level = "Warning", location = "(base)", description = "SHALL, if possible, contain a code from value set http://hl7.org/fhir/ValueSet/substance-category", expression = "category.exists() implies (category.all(memberOf('http://hl7.org/fhir/ValueSet/substance-category', 'extensible')))", generated = true ) @Generated("com.ibm.fhir.tools.CodeGenerator") public class Substance extends DomainResource { @Summary private final List identifier; @Summary @Binding( bindingName = "FHIRSubstanceStatus", strength = BindingStrength.Value.REQUIRED, description = "A code to indicate if the substance is actively used.", valueSet = "http://hl7.org/fhir/ValueSet/substance-status|4.0.1" ) private final FHIRSubstanceStatus status; @Summary @Binding( bindingName = "SubstanceCategory", strength = BindingStrength.Value.EXTENSIBLE, description = "Category or classification of substance.", valueSet = "http://hl7.org/fhir/ValueSet/substance-category" ) private final List category; @Summary @Binding( bindingName = "SubstanceCode", strength = BindingStrength.Value.EXAMPLE, description = "Substance codes.", valueSet = "http://hl7.org/fhir/ValueSet/substance-code" ) @Required private final CodeableConcept code; @Summary private final String description; @Summary private final List instance; @Summary private final List ingredient; private Substance(Builder builder) { super(builder); identifier = Collections.unmodifiableList(builder.identifier); status = builder.status; category = Collections.unmodifiableList(builder.category); code = builder.code; description = builder.description; instance = Collections.unmodifiableList(builder.instance); ingredient = Collections.unmodifiableList(builder.ingredient); } /** * Unique identifier for the substance. * * @return * An unmodifiable list containing immutable objects of type {@link Identifier} that may be empty. */ public List getIdentifier() { return identifier; } /** * A code to indicate if the substance is actively used. * * @return * An immutable object of type {@link FHIRSubstanceStatus} that may be null. */ public FHIRSubstanceStatus getStatus() { return status; } /** * A code that classifies the general type of substance. This is used for searching, sorting and display purposes. * * @return * An unmodifiable list containing immutable objects of type {@link CodeableConcept} that may be empty. */ public List getCategory() { return category; } /** * A code (or set of codes) that identify this substance. * * @return * An immutable object of type {@link CodeableConcept} that is non-null. */ public CodeableConcept getCode() { return code; } /** * A description of the substance - its appearance, handling requirements, and other usage notes. * * @return * An immutable object of type {@link String} that may be null. */ public String getDescription() { return description; } /** * Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance. * * @return * An unmodifiable list containing immutable objects of type {@link Instance} that may be empty. */ public List getInstance() { return instance; } /** * A substance can be composed of other substances. * * @return * An unmodifiable list containing immutable objects of type {@link Ingredient} that may be empty. */ public List getIngredient() { return ingredient; } @Override public boolean hasChildren() { return super.hasChildren() || !identifier.isEmpty() || (status != null) || !category.isEmpty() || (code != null) || (description != null) || !instance.isEmpty() || !ingredient.isEmpty(); } @Override public void accept(java.lang.String elementName, int elementIndex, Visitor visitor) { if (visitor.preVisit(this)) { visitor.visitStart(elementName, elementIndex, this); if (visitor.visit(elementName, elementIndex, this)) { // visit children accept(id, "id", visitor); accept(meta, "meta", visitor); accept(implicitRules, "implicitRules", visitor); accept(language, "language", visitor); accept(text, "text", visitor); accept(contained, "contained", visitor, Resource.class); accept(extension, "extension", visitor, Extension.class); accept(modifierExtension, "modifierExtension", visitor, Extension.class); accept(identifier, "identifier", visitor, Identifier.class); accept(status, "status", visitor); accept(category, "category", visitor, CodeableConcept.class); accept(code, "code", visitor); accept(description, "description", visitor); accept(instance, "instance", visitor, Instance.class); accept(ingredient, "ingredient", visitor, Ingredient.class); } visitor.visitEnd(elementName, elementIndex, this); visitor.postVisit(this); } } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Substance other = (Substance) obj; return Objects.equals(id, other.id) && Objects.equals(meta, other.meta) && Objects.equals(implicitRules, other.implicitRules) && Objects.equals(language, other.language) && Objects.equals(text, other.text) && Objects.equals(contained, other.contained) && Objects.equals(extension, other.extension) && Objects.equals(modifierExtension, other.modifierExtension) && Objects.equals(identifier, other.identifier) && Objects.equals(status, other.status) && Objects.equals(category, other.category) && Objects.equals(code, other.code) && Objects.equals(description, other.description) && Objects.equals(instance, other.instance) && Objects.equals(ingredient, other.ingredient); } @Override public int hashCode() { int result = hashCode; if (result == 0) { result = Objects.hash(id, meta, implicitRules, language, text, contained, extension, modifierExtension, identifier, status, category, code, description, instance, ingredient); hashCode = result; } return result; } @Override public Builder toBuilder() { return new Builder().from(this); } public static Builder builder() { return new Builder(); } public static class Builder extends DomainResource.Builder { private List identifier = new ArrayList<>(); private FHIRSubstanceStatus status; private List category = new ArrayList<>(); private CodeableConcept code; private String description; private List instance = new ArrayList<>(); private List ingredient = new ArrayList<>(); private Builder() { super(); } /** * The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes. * * @param id * Logical id of this artifact * * @return * A reference to this Builder instance */ @Override public Builder id(java.lang.String id) { return (Builder) super.id(id); } /** * The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content * might not always be associated with version changes to the resource. * * @param meta * Metadata about the resource * * @return * A reference to this Builder instance */ @Override public Builder meta(Meta meta) { return (Builder) super.meta(meta); } /** * A reference to a set of rules that were followed when the resource was constructed, and which must be understood when * processing the content. Often, this is a reference to an implementation guide that defines the special rules along * with other profiles etc. * * @param implicitRules * A set of rules under which this content was created * * @return * A reference to this Builder instance */ @Override public Builder implicitRules(Uri implicitRules) { return (Builder) super.implicitRules(implicitRules); } /** * The base language in which the resource is written. * * @param language * Language of the resource content * * @return * A reference to this Builder instance */ @Override public Builder language(Code language) { return (Builder) super.language(language); } /** * A human-readable narrative that contains a summary of the resource and can be used to represent the content of the * resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient * detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what * content should be represented in the narrative to ensure clinical safety. * * @param text * Text summary of the resource, for human interpretation * * @return * A reference to this Builder instance */ @Override public Builder text(Narrative text) { return (Builder) super.text(text); } /** * These resources do not have an independent existence apart from the resource that contains them - they cannot be * identified independently, and nor can they have their own independent transaction scope. * *

Adds new element(s) to the existing list * * @param contained * Contained, inline Resources * * @return * A reference to this Builder instance */ @Override public Builder contained(Resource... contained) { return (Builder) super.contained(contained); } /** * These resources do not have an independent existence apart from the resource that contains them - they cannot be * identified independently, and nor can they have their own independent transaction scope. * *

Replaces the existing list with a new one containing elements from the Collection * * @param contained * Contained, inline Resources * * @return * A reference to this Builder instance */ @Override public Builder contained(Collection contained) { return (Builder) super.contained(contained); } /** * May be used to represent additional information that is not part of the basic definition of the resource. To make the * use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of * extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part * of the definition of the extension. * *

Adds new element(s) to the existing list * * @param extension * Additional content defined by implementations * * @return * A reference to this Builder instance */ @Override public Builder extension(Extension... extension) { return (Builder) super.extension(extension); } /** * May be used to represent additional information that is not part of the basic definition of the resource. To make the * use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of * extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part * of the definition of the extension. * *

Replaces the existing list with a new one containing elements from the Collection * * @param extension * Additional content defined by implementations * * @return * A reference to this Builder instance */ @Override public Builder extension(Collection extension) { return (Builder) super.extension(extension); } /** * May be used to represent additional information that is not part of the basic definition of the resource and that * modifies the understanding of the element that contains it and/or the understanding of the containing element's * descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and * manageable, there is a strict set of governance applied to the definition and use of extensions. Though any * implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the * definition of the extension. Applications processing a resource are required to check for modifier extensions. * *

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot * change the meaning of modifierExtension itself). * *

Adds new element(s) to the existing list * * @param modifierExtension * Extensions that cannot be ignored * * @return * A reference to this Builder instance */ @Override public Builder modifierExtension(Extension... modifierExtension) { return (Builder) super.modifierExtension(modifierExtension); } /** * May be used to represent additional information that is not part of the basic definition of the resource and that * modifies the understanding of the element that contains it and/or the understanding of the containing element's * descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and * manageable, there is a strict set of governance applied to the definition and use of extensions. Though any * implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the * definition of the extension. Applications processing a resource are required to check for modifier extensions. * *

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot * change the meaning of modifierExtension itself). * *

Replaces the existing list with a new one containing elements from the Collection * * @param modifierExtension * Extensions that cannot be ignored * * @return * A reference to this Builder instance */ @Override public Builder modifierExtension(Collection modifierExtension) { return (Builder) super.modifierExtension(modifierExtension); } /** * Unique identifier for the substance. * *

Adds new element(s) to the existing list * * @param identifier * Unique identifier * * @return * A reference to this Builder instance */ public Builder identifier(Identifier... identifier) { for (Identifier value : identifier) { this.identifier.add(value); } return this; } /** * Unique identifier for the substance. * *

Replaces the existing list with a new one containing elements from the Collection * * @param identifier * Unique identifier * * @return * A reference to this Builder instance */ public Builder identifier(Collection identifier) { this.identifier = new ArrayList<>(identifier); return this; } /** * A code to indicate if the substance is actively used. * * @param status * active | inactive | entered-in-error * * @return * A reference to this Builder instance */ public Builder status(FHIRSubstanceStatus status) { this.status = status; return this; } /** * A code that classifies the general type of substance. This is used for searching, sorting and display purposes. * *

Adds new element(s) to the existing list * * @param category * What class/type of substance this is * * @return * A reference to this Builder instance */ public Builder category(CodeableConcept... category) { for (CodeableConcept value : category) { this.category.add(value); } return this; } /** * A code that classifies the general type of substance. This is used for searching, sorting and display purposes. * *

Replaces the existing list with a new one containing elements from the Collection * * @param category * What class/type of substance this is * * @return * A reference to this Builder instance */ public Builder category(Collection category) { this.category = new ArrayList<>(category); return this; } /** * A code (or set of codes) that identify this substance. * *

This element is required. * * @param code * What substance this is * * @return * A reference to this Builder instance */ public Builder code(CodeableConcept code) { this.code = code; return this; } /** * A description of the substance - its appearance, handling requirements, and other usage notes. * * @param description * Textual description of the substance, comments * * @return * A reference to this Builder instance */ public Builder description(String description) { this.description = description; return this; } /** * Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance. * *

Adds new element(s) to the existing list * * @param instance * If this describes a specific package/container of the substance * * @return * A reference to this Builder instance */ public Builder instance(Instance... instance) { for (Instance value : instance) { this.instance.add(value); } return this; } /** * Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance. * *

Replaces the existing list with a new one containing elements from the Collection * * @param instance * If this describes a specific package/container of the substance * * @return * A reference to this Builder instance */ public Builder instance(Collection instance) { this.instance = new ArrayList<>(instance); return this; } /** * A substance can be composed of other substances. * *

Adds new element(s) to the existing list * * @param ingredient * Composition information about the substance * * @return * A reference to this Builder instance */ public Builder ingredient(Ingredient... ingredient) { for (Ingredient value : ingredient) { this.ingredient.add(value); } return this; } /** * A substance can be composed of other substances. * *

Replaces the existing list with a new one containing elements from the Collection * * @param ingredient * Composition information about the substance * * @return * A reference to this Builder instance */ public Builder ingredient(Collection ingredient) { this.ingredient = new ArrayList<>(ingredient); return this; } /** * Build the {@link Substance} * *

Required elements: *

    *
  • code
  • *
* * @return * An immutable object of type {@link Substance} * @throws IllegalStateException * if the current state cannot be built into a valid Substance per the base specification */ @Override public Substance build() { Substance substance = new Substance(this); if (validating) { validate(substance); } return substance; } protected void validate(Substance substance) { super.validate(substance); ValidationSupport.checkList(substance.identifier, "identifier", Identifier.class); ValidationSupport.checkList(substance.category, "category", CodeableConcept.class); ValidationSupport.requireNonNull(substance.code, "code"); ValidationSupport.checkList(substance.instance, "instance", Instance.class); ValidationSupport.checkList(substance.ingredient, "ingredient", Ingredient.class); } protected Builder from(Substance substance) { super.from(substance); identifier.addAll(substance.identifier); status = substance.status; category.addAll(substance.category); code = substance.code; description = substance.description; instance.addAll(substance.instance); ingredient.addAll(substance.ingredient); return this; } } /** * Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance. */ public static class Instance extends BackboneElement { @Summary private final Identifier identifier; @Summary private final DateTime expiry; @Summary private final SimpleQuantity quantity; private Instance(Builder builder) { super(builder); identifier = builder.identifier; expiry = builder.expiry; quantity = builder.quantity; } /** * Identifier associated with the package/container (usually a label affixed directly). * * @return * An immutable object of type {@link Identifier} that may be null. */ public Identifier getIdentifier() { return identifier; } /** * When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry. * * @return * An immutable object of type {@link DateTime} that may be null. */ public DateTime getExpiry() { return expiry; } /** * The amount of the substance. * * @return * An immutable object of type {@link SimpleQuantity} that may be null. */ public SimpleQuantity getQuantity() { return quantity; } @Override public boolean hasChildren() { return super.hasChildren() || (identifier != null) || (expiry != null) || (quantity != null); } @Override public void accept(java.lang.String elementName, int elementIndex, Visitor visitor) { if (visitor.preVisit(this)) { visitor.visitStart(elementName, elementIndex, this); if (visitor.visit(elementName, elementIndex, this)) { // visit children accept(id, "id", visitor); accept(extension, "extension", visitor, Extension.class); accept(modifierExtension, "modifierExtension", visitor, Extension.class); accept(identifier, "identifier", visitor); accept(expiry, "expiry", visitor); accept(quantity, "quantity", visitor); } visitor.visitEnd(elementName, elementIndex, this); visitor.postVisit(this); } } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Instance other = (Instance) obj; return Objects.equals(id, other.id) && Objects.equals(extension, other.extension) && Objects.equals(modifierExtension, other.modifierExtension) && Objects.equals(identifier, other.identifier) && Objects.equals(expiry, other.expiry) && Objects.equals(quantity, other.quantity); } @Override public int hashCode() { int result = hashCode; if (result == 0) { result = Objects.hash(id, extension, modifierExtension, identifier, expiry, quantity); hashCode = result; } return result; } @Override public Builder toBuilder() { return new Builder().from(this); } public static Builder builder() { return new Builder(); } public static class Builder extends BackboneElement.Builder { private Identifier identifier; private DateTime expiry; private SimpleQuantity quantity; private Builder() { super(); } /** * Unique id for the element within a resource (for internal references). This may be any string value that does not * contain spaces. * * @param id * Unique id for inter-element referencing * * @return * A reference to this Builder instance */ @Override public Builder id(java.lang.String id) { return (Builder) super.id(id); } /** * May be used to represent additional information that is not part of the basic definition of the element. To make the * use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of * extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part * of the definition of the extension. * *

Adds new element(s) to the existing list * * @param extension * Additional content defined by implementations * * @return * A reference to this Builder instance */ @Override public Builder extension(Extension... extension) { return (Builder) super.extension(extension); } /** * May be used to represent additional information that is not part of the basic definition of the element. To make the * use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of * extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part * of the definition of the extension. * *

Replaces the existing list with a new one containing elements from the Collection * * @param extension * Additional content defined by implementations * * @return * A reference to this Builder instance */ @Override public Builder extension(Collection extension) { return (Builder) super.extension(extension); } /** * May be used to represent additional information that is not part of the basic definition of the element and that * modifies the understanding of the element in which it is contained and/or the understanding of the containing * element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe * and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any * implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the * extension. Applications processing a resource are required to check for modifier extensions. * *

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot * change the meaning of modifierExtension itself). * *

Adds new element(s) to the existing list * * @param modifierExtension * Extensions that cannot be ignored even if unrecognized * * @return * A reference to this Builder instance */ @Override public Builder modifierExtension(Extension... modifierExtension) { return (Builder) super.modifierExtension(modifierExtension); } /** * May be used to represent additional information that is not part of the basic definition of the element and that * modifies the understanding of the element in which it is contained and/or the understanding of the containing * element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe * and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any * implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the * extension. Applications processing a resource are required to check for modifier extensions. * *

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot * change the meaning of modifierExtension itself). * *

Replaces the existing list with a new one containing elements from the Collection * * @param modifierExtension * Extensions that cannot be ignored even if unrecognized * * @return * A reference to this Builder instance */ @Override public Builder modifierExtension(Collection modifierExtension) { return (Builder) super.modifierExtension(modifierExtension); } /** * Identifier associated with the package/container (usually a label affixed directly). * * @param identifier * Identifier of the package/container * * @return * A reference to this Builder instance */ public Builder identifier(Identifier identifier) { this.identifier = identifier; return this; } /** * When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry. * * @param expiry * When no longer valid to use * * @return * A reference to this Builder instance */ public Builder expiry(DateTime expiry) { this.expiry = expiry; return this; } /** * The amount of the substance. * * @param quantity * Amount of substance in the package * * @return * A reference to this Builder instance */ public Builder quantity(SimpleQuantity quantity) { this.quantity = quantity; return this; } /** * Build the {@link Instance} * * @return * An immutable object of type {@link Instance} * @throws IllegalStateException * if the current state cannot be built into a valid Instance per the base specification */ @Override public Instance build() { Instance instance = new Instance(this); if (validating) { validate(instance); } return instance; } protected void validate(Instance instance) { super.validate(instance); ValidationSupport.requireValueOrChildren(instance); } protected Builder from(Instance instance) { super.from(instance); identifier = instance.identifier; expiry = instance.expiry; quantity = instance.quantity; return this; } } } /** * A substance can be composed of other substances. */ public static class Ingredient extends BackboneElement { @Summary private final Ratio quantity; @Summary @ReferenceTarget({ "Substance" }) @Choice({ CodeableConcept.class, Reference.class }) @Binding( bindingName = "SubstanceIngredient", strength = BindingStrength.Value.EXAMPLE, description = "Substance Ingredient codes.", valueSet = "http://hl7.org/fhir/ValueSet/substance-code" ) @Required private final Element substance; private Ingredient(Builder builder) { super(builder); quantity = builder.quantity; substance = builder.substance; } /** * The amount of the ingredient in the substance - a concentration ratio. * * @return * An immutable object of type {@link Ratio} that may be null. */ public Ratio getQuantity() { return quantity; } /** * Another substance that is a component of this substance. * * @return * An immutable object of type {@link Element} that is non-null. */ public Element getSubstance() { return substance; } @Override public boolean hasChildren() { return super.hasChildren() || (quantity != null) || (substance != null); } @Override public void accept(java.lang.String elementName, int elementIndex, Visitor visitor) { if (visitor.preVisit(this)) { visitor.visitStart(elementName, elementIndex, this); if (visitor.visit(elementName, elementIndex, this)) { // visit children accept(id, "id", visitor); accept(extension, "extension", visitor, Extension.class); accept(modifierExtension, "modifierExtension", visitor, Extension.class); accept(quantity, "quantity", visitor); accept(substance, "substance", visitor); } visitor.visitEnd(elementName, elementIndex, this); visitor.postVisit(this); } } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Ingredient other = (Ingredient) obj; return Objects.equals(id, other.id) && Objects.equals(extension, other.extension) && Objects.equals(modifierExtension, other.modifierExtension) && Objects.equals(quantity, other.quantity) && Objects.equals(substance, other.substance); } @Override public int hashCode() { int result = hashCode; if (result == 0) { result = Objects.hash(id, extension, modifierExtension, quantity, substance); hashCode = result; } return result; } @Override public Builder toBuilder() { return new Builder().from(this); } public static Builder builder() { return new Builder(); } public static class Builder extends BackboneElement.Builder { private Ratio quantity; private Element substance; private Builder() { super(); } /** * Unique id for the element within a resource (for internal references). This may be any string value that does not * contain spaces. * * @param id * Unique id for inter-element referencing * * @return * A reference to this Builder instance */ @Override public Builder id(java.lang.String id) { return (Builder) super.id(id); } /** * May be used to represent additional information that is not part of the basic definition of the element. To make the * use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of * extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part * of the definition of the extension. * *

Adds new element(s) to the existing list * * @param extension * Additional content defined by implementations * * @return * A reference to this Builder instance */ @Override public Builder extension(Extension... extension) { return (Builder) super.extension(extension); } /** * May be used to represent additional information that is not part of the basic definition of the element. To make the * use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of * extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part * of the definition of the extension. * *

Replaces the existing list with a new one containing elements from the Collection * * @param extension * Additional content defined by implementations * * @return * A reference to this Builder instance */ @Override public Builder extension(Collection extension) { return (Builder) super.extension(extension); } /** * May be used to represent additional information that is not part of the basic definition of the element and that * modifies the understanding of the element in which it is contained and/or the understanding of the containing * element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe * and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any * implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the * extension. Applications processing a resource are required to check for modifier extensions. * *

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot * change the meaning of modifierExtension itself). * *

Adds new element(s) to the existing list * * @param modifierExtension * Extensions that cannot be ignored even if unrecognized * * @return * A reference to this Builder instance */ @Override public Builder modifierExtension(Extension... modifierExtension) { return (Builder) super.modifierExtension(modifierExtension); } /** * May be used to represent additional information that is not part of the basic definition of the element and that * modifies the understanding of the element in which it is contained and/or the understanding of the containing * element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe * and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any * implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the * extension. Applications processing a resource are required to check for modifier extensions. * *

Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot * change the meaning of modifierExtension itself). * *

Replaces the existing list with a new one containing elements from the Collection * * @param modifierExtension * Extensions that cannot be ignored even if unrecognized * * @return * A reference to this Builder instance */ @Override public Builder modifierExtension(Collection modifierExtension) { return (Builder) super.modifierExtension(modifierExtension); } /** * The amount of the ingredient in the substance - a concentration ratio. * * @param quantity * Optional amount (concentration) * * @return * A reference to this Builder instance */ public Builder quantity(Ratio quantity) { this.quantity = quantity; return this; } /** * Another substance that is a component of this substance. * *

This element is required. * *

This is a choice element with the following allowed types: *

    *
  • {@link CodeableConcept}
  • *
  • {@link Reference}
  • *
* * When of type {@link Reference}, the allowed resource types for this reference are: *
    *
  • {@link Substance}
  • *
* * @param substance * A component of the substance * * @return * A reference to this Builder instance */ public Builder substance(Element substance) { this.substance = substance; return this; } /** * Build the {@link Ingredient} * *

Required elements: *

    *
  • substance
  • *
* * @return * An immutable object of type {@link Ingredient} * @throws IllegalStateException * if the current state cannot be built into a valid Ingredient per the base specification */ @Override public Ingredient build() { Ingredient ingredient = new Ingredient(this); if (validating) { validate(ingredient); } return ingredient; } protected void validate(Ingredient ingredient) { super.validate(ingredient); ValidationSupport.requireChoiceElement(ingredient.substance, "substance", CodeableConcept.class, Reference.class); ValidationSupport.checkReferenceType(ingredient.substance, "substance", "Substance"); ValidationSupport.requireValueOrChildren(ingredient); } protected Builder from(Ingredient ingredient) { super.from(ingredient); quantity = ingredient.quantity; substance = ingredient.substance; return this; } } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy