ca.uhn.fhir.model.dstu2.composite.QuantityDt Maven / Gradle / Ivy
package ca.uhn.fhir.model.dstu2.composite;
import java.net.URI;
import java.math.BigDecimal;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import ca.uhn.fhir.model.api.*;
import ca.uhn.fhir.model.primitive.*;
import ca.uhn.fhir.model.api.annotation.*;
import ca.uhn.fhir.model.base.composite.*;
import ca.uhn.fhir.model.dstu2.valueset.AddressTypeEnum;
import ca.uhn.fhir.model.dstu2.valueset.AddressUseEnum;
import ca.uhn.fhir.model.dstu2.valueset.AggregationModeEnum;
import ca.uhn.fhir.model.dstu2.valueset.BindingStrengthEnum;
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.valueset.ConstraintSeverityEnum;
import ca.uhn.fhir.model.dstu2.valueset.ContactPointSystemEnum;
import ca.uhn.fhir.model.dstu2.valueset.ContactPointUseEnum;
import ca.uhn.fhir.model.dstu2.resource.Device;
import ca.uhn.fhir.model.dstu2.valueset.EventTimingEnum;
import ca.uhn.fhir.model.dstu2.valueset.IdentifierTypeCodesEnum;
import ca.uhn.fhir.model.dstu2.valueset.IdentifierUseEnum;
import ca.uhn.fhir.model.dstu2.valueset.NameUseEnum;
import ca.uhn.fhir.model.dstu2.resource.Organization;
import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.dstu2.composite.PeriodDt;
import ca.uhn.fhir.model.dstu2.resource.Practitioner;
import ca.uhn.fhir.model.dstu2.valueset.PropertyRepresentationEnum;
import ca.uhn.fhir.model.dstu2.valueset.QuantityComparatorEnum;
import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
import ca.uhn.fhir.model.dstu2.composite.RangeDt;
import ca.uhn.fhir.model.dstu2.resource.RelatedPerson;
import ca.uhn.fhir.model.dstu2.valueset.SignatureTypeCodesEnum;
import ca.uhn.fhir.model.dstu2.valueset.SlicingRulesEnum;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.dstu2.valueset.TimingAbbreviationEnum;
import ca.uhn.fhir.model.dstu2.valueset.UnitsOfTimeEnum;
import ca.uhn.fhir.model.dstu2.resource.ValueSet;
import ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt;
import ca.uhn.fhir.model.dstu2.composite.DurationDt;
import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt;
import ca.uhn.fhir.model.primitive.Base64BinaryDt;
import ca.uhn.fhir.model.primitive.BooleanDt;
import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.DecimalDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.model.primitive.IntegerDt;
import ca.uhn.fhir.model.primitive.MarkdownDt;
import ca.uhn.fhir.model.primitive.PositiveIntDt;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.UnsignedIntDt;
import ca.uhn.fhir.model.primitive.UriDt;
/**
* HAPI/FHIR QuantityDt Datatype
* ()
*
*
* Definition:
* A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies
*
*
*
* Requirements:
* Need to able to capture all sorts of measured values, even if the measured value are not precisely quantified. Values include exact measures such as 3.51g, customary units such as 3 tablets, and currencies such as $100.32USD
*
*/
@DatatypeDef(name="Quantity")
public class QuantityDt
extends BaseQuantityDt
implements ICompositeDatatype
{
/**
* Constructor
*/
public QuantityDt() {
// nothing
}
/**
* Constructor
*/
@SimpleSetter
public QuantityDt(@SimpleSetter.Parameter(name="theValue") double theValue) {
setValue(theValue);
}
/**
* Constructor
*/
@SimpleSetter
public QuantityDt(@SimpleSetter.Parameter(name="theValue") long theValue) {
setValue(theValue);
}
/**
* Constructor
*/
@SimpleSetter
public QuantityDt(@SimpleSetter.Parameter(name = "theComparator") QuantityComparatorEnum theComparator, @SimpleSetter.Parameter(name = "theValue") double theValue,
@SimpleSetter.Parameter(name = "theUnits") String theUnits) {
setValue(theValue);
setComparator(theComparator);
setUnits(theUnits);
}
/**
* Constructor
*/
@SimpleSetter
public QuantityDt(@SimpleSetter.Parameter(name = "theComparator") QuantityComparatorEnum theComparator, @SimpleSetter.Parameter(name = "theValue") long theValue,
@SimpleSetter.Parameter(name = "theUnits") String theUnits) {
setValue(theValue);
setComparator(theComparator);
setUnits(theUnits);
}
/**
* Constructor
*/
@SimpleSetter
public QuantityDt(@SimpleSetter.Parameter(name="theComparator") QuantityComparatorEnum theComparator, @SimpleSetter.Parameter(name="theValue") double theValue, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theUnits") String theUnits) {
setValue(theValue);
setComparator(theComparator);
setSystem(theSystem);
setUnits(theUnits);
}
/**
* Constructor
*/
@SimpleSetter
public QuantityDt(@SimpleSetter.Parameter(name="theComparator") QuantityComparatorEnum theComparator, @SimpleSetter.Parameter(name="theValue") long theValue, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theUnits") String theUnits) {
setValue(theValue);
setComparator(theComparator);
setSystem(theSystem);
setUnits(theUnits);
}
/**
* @deprecated Use {@link #setUnit(String)} instead - Quantity.units was renamed to Quantity.unit in DSTU2
*/
@Deprecated
@Override
public BaseQuantityDt setUnits(String theString) {
return setUnit(theString);
}
/**
* @deprecated Use {@link #getUnitElement()} - Quantity.units was renamed to Quantity.unit in DSTU2
*/
@Deprecated
@Override
public StringDt getUnitsElement() {
return getUnitElement();
}
@Child(name="value", type=DecimalDt.class, order=0, min=0, max=1, summary=true, modifier=false)
@Description(
shortDefinition="",
formalDefinition="The value of the measured amount. The value includes an implicit precision in the presentation of the value"
)
private DecimalDt myValue;
@Child(name="comparator", type=CodeDt.class, order=1, min=0, max=1, summary=true, modifier=true)
@Description(
shortDefinition="",
formalDefinition="How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value"
)
@ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/quantity-comparator")
private BoundCodeDt myComparator;
@Child(name="unit", type=StringDt.class, order=2, min=0, max=1, summary=true, modifier=false)
@Description(
shortDefinition="",
formalDefinition="A human-readable form of the unit"
)
private StringDt myUnit;
@Child(name="system", type=UriDt.class, order=3, min=0, max=1, summary=true, modifier=false)
@Description(
shortDefinition="",
formalDefinition="The identification of the system that provides the coded form of the unit"
)
private UriDt mySystem;
@Child(name="code", type=CodeDt.class, order=4, min=0, max=1, summary=true, modifier=false)
@Description(
shortDefinition="",
formalDefinition="A computer processable form of the unit in some unit representation system"
)
private CodeDt myCode;
@Override
public boolean isEmpty() {
return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myValue, myComparator, myUnit, mySystem, myCode);
}
@Override
public List getAllPopulatedChildElementsOfType(Class theType) {
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myValue, myComparator, myUnit, mySystem, myCode);
}
/**
* Gets the value(s) for value ().
* creating it if it does
* not exist. Will not return null
.
*
*
* Definition:
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
*
*/
public DecimalDt getValueElement() {
if (myValue == null) {
myValue = new DecimalDt();
}
return myValue;
}
/**
* Gets the value(s) for value ().
* creating it if it does
* not exist. This method may return null
.
*
*
* Definition:
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
*
*/
public BigDecimal getValue() {
return getValueElement().getValue();
}
/**
* Sets the value(s) for value ()
*
*
* Definition:
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
*
*/
public QuantityDt setValue(DecimalDt theValue) {
myValue = theValue;
return this;
}
/**
* Sets the value for value ()
*
*
* Definition:
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
*
*/
public QuantityDt setValue( double theValue) {
myValue = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for value ()
*
*
* Definition:
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
*
*/
public QuantityDt setValue( long theValue) {
myValue = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for value ()
*
*
* Definition:
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
*
*/
public QuantityDt setValue( java.math.BigDecimal theValue) {
myValue = new DecimalDt(theValue);
return this;
}
/**
* Gets the value(s) for comparator ().
* creating it if it does
* not exist. Will not return null
.
*
*
* Definition:
* How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value
*
*/
public BoundCodeDt getComparatorElement() {
if (myComparator == null) {
myComparator = new BoundCodeDt(QuantityComparatorEnum.VALUESET_BINDER);
}
return myComparator;
}
/**
* Gets the value(s) for comparator ().
* creating it if it does
* not exist. This method may return null
.
*
*
* Definition:
* How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value
*
*/
public String getComparator() {
return getComparatorElement().getValue();
}
/**
* Sets the value(s) for comparator ()
*
*
* Definition:
* How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value
*
*/
public QuantityDt setComparator(BoundCodeDt theValue) {
myComparator = theValue;
return this;
}
/**
* Sets the value(s) for comparator ()
*
*
* Definition:
* How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value
*
*/
public QuantityDt setComparator(QuantityComparatorEnum theValue) {
setComparator(new BoundCodeDt(QuantityComparatorEnum.VALUESET_BINDER, theValue));
/*
getComparatorElement().setValueAsEnum(theValue);
*/
return this;
}
/**
* Gets the value(s) for unit ().
* creating it if it does
* not exist. Will not return null
.
*
*
* Definition:
* A human-readable form of the unit
*
*/
public StringDt getUnitElement() {
if (myUnit == null) {
myUnit = new StringDt();
}
return myUnit;
}
/**
* Gets the value(s) for unit ().
* creating it if it does
* not exist. This method may return null
.
*
*
* Definition:
* A human-readable form of the unit
*
*/
public String getUnit() {
return getUnitElement().getValue();
}
/**
* Sets the value(s) for unit ()
*
*
* Definition:
* A human-readable form of the unit
*
*/
public QuantityDt setUnit(StringDt theValue) {
myUnit = theValue;
return this;
}
/**
* Sets the value for unit ()
*
*
* Definition:
* A human-readable form of the unit
*
*/
public QuantityDt setUnit( String theString) {
myUnit = new StringDt(theString);
return this;
}
/**
* Gets the value(s) for system ().
* creating it if it does
* not exist. Will not return null
.
*
*
* Definition:
* The identification of the system that provides the coded form of the unit
*
*/
public UriDt getSystemElement() {
if (mySystem == null) {
mySystem = new UriDt();
}
return mySystem;
}
/**
* Gets the value(s) for system ().
* creating it if it does
* not exist. This method may return null
.
*
*
* Definition:
* The identification of the system that provides the coded form of the unit
*
*/
public String getSystem() {
return getSystemElement().getValue();
}
/**
* Sets the value(s) for system ()
*
*
* Definition:
* The identification of the system that provides the coded form of the unit
*
*/
public QuantityDt setSystem(UriDt theValue) {
mySystem = theValue;
return this;
}
/**
* Sets the value for system ()
*
*
* Definition:
* The identification of the system that provides the coded form of the unit
*
*/
public QuantityDt setSystem( String theUri) {
mySystem = new UriDt(theUri);
return this;
}
/**
* Gets the value(s) for code ().
* creating it if it does
* not exist. Will not return null
.
*
*
* Definition:
* A computer processable form of the unit in some unit representation system
*
*/
public CodeDt getCodeElement() {
if (myCode == null) {
myCode = new CodeDt();
}
return myCode;
}
/**
* Gets the value(s) for code ().
* creating it if it does
* not exist. This method may return null
.
*
*
* Definition:
* A computer processable form of the unit in some unit representation system
*
*/
public String getCode() {
return getCodeElement().getValue();
}
/**
* Sets the value(s) for code ()
*
*
* Definition:
* A computer processable form of the unit in some unit representation system
*
*/
public QuantityDt setCode(CodeDt theValue) {
myCode = theValue;
return this;
}
/**
* Sets the value for code ()
*
*
* Definition:
* A computer processable form of the unit in some unit representation system
*
*/
public QuantityDt setCode( String theCode) {
myCode = new CodeDt(theCode);
return this;
}
}