Package ca.uhn.fhir.model.primitive
Class DecimalDt
- java.lang.Object
-
- ca.uhn.fhir.model.api.BaseElement
-
- ca.uhn.fhir.model.api.BaseIdentifiableElement
-
- ca.uhn.fhir.model.api.BasePrimitive<BigDecimal>
-
- ca.uhn.fhir.model.primitive.DecimalDt
-
- All Implemented Interfaces:
IDatatype,IElement,IIdentifiableElement,IPrimitiveDatatype<BigDecimal>,ISupportsUndeclaredExtensions,Externalizable,Serializable,Comparable<DecimalDt>,IBase,IBaseDatatype,IBaseDecimalDatatype,IPrimitiveType<BigDecimal>
public class DecimalDt extends BasePrimitive<BigDecimal> implements Comparable<DecimalDt>, IBaseDecimalDatatype
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(DecimalDt theObj)protected Stringencode(BigDecimal theValue)Subclasses must override to convert a "coerced" value into an encoded one.intgetValueAsInteger()Gets the value as an integer, usingBigDecimal.intValue()NumbergetValueAsNumber()protected BigDecimalparse(String theValue)Subclasses must override to convert an encoded representation of this datatype into a "coerced" onevoidround(int thePrecision)Rounds the value to the given previsionvoidround(int thePrecision, RoundingMode theRoundingMode)Rounds the value to the given previsionvoidsetValueAsInteger(int theValue)Sets a new value using an integer-
Methods inherited from class ca.uhn.fhir.model.api.BasePrimitive
equals, getValue, getValueAsString, hashCode, hasValue, isEmpty, readExternal, setValue, setValueAsString, toString, updateStringValue, writeExternal
-
Methods inherited from class ca.uhn.fhir.model.api.BaseIdentifiableElement
getElementSpecificId, getId, setElementSpecificId, setId, setId
-
Methods inherited from class ca.uhn.fhir.model.api.BaseElement
addUndeclaredExtension, addUndeclaredExtension, addUndeclaredExtension, getAllUndeclaredExtensions, getFormatCommentsPost, getFormatCommentsPre, getUndeclaredExtensions, getUndeclaredExtensionsByUrl, getUndeclaredModifierExtensions, getUserData, hasFormatComment, isBaseEmpty, setUserData
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hl7.fhir.instance.model.api.IBase
fhirType, getFormatCommentsPost, getFormatCommentsPre, getUserData, hasFormatComment, isEmpty, setUserData
-
Methods inherited from interface org.hl7.fhir.instance.model.api.IPrimitiveType
hasValue
-
-
-
-
Method Detail
-
compareTo
public int compareTo(DecimalDt theObj)
- Specified by:
compareToin interfaceComparable<DecimalDt>
-
encode
protected String encode(BigDecimal theValue)
Description copied from class:BasePrimitiveSubclasses must override to convert a "coerced" value into an encoded one.- Specified by:
encodein classBasePrimitive<BigDecimal>- Parameters:
theValue- Will not be null- Returns:
- May return null if the value does not correspond to anything
-
getValueAsInteger
public int getValueAsInteger()
Gets the value as an integer, usingBigDecimal.intValue()
-
getValueAsNumber
public Number getValueAsNumber()
-
parse
protected BigDecimal parse(String theValue)
Description copied from class:BasePrimitiveSubclasses must override to convert an encoded representation of this datatype into a "coerced" one- Specified by:
parsein classBasePrimitive<BigDecimal>- Parameters:
theValue- Will not be null- Returns:
- May return null if the value does not correspond to anything
-
round
public void round(int thePrecision)
Rounds the value to the given prevision- See Also:
MathContext.getPrecision()
-
round
public void round(int thePrecision, RoundingMode theRoundingMode)
Rounds the value to the given prevision
-
setValueAsInteger
public void setValueAsInteger(int theValue)
Sets a new value using an integer
-
-