
Package org.hl7.fhir.r4.model
Class DecimalType
java.lang.Object
- All Implemented Interfaces:
ca.uhn.fhir.model.api.IElement,Externalizable,Serializable,Comparable<DecimalType>,org.hl7.fhir.instance.model.api.IBase,org.hl7.fhir.instance.model.api.IBaseDatatype,org.hl7.fhir.instance.model.api.IBaseDecimalDatatype,org.hl7.fhir.instance.model.api.IBaseElement,org.hl7.fhir.instance.model.api.IBaseHasExtensions,org.hl7.fhir.instance.model.api.IPrimitiveType<BigDecimal>
public class DecimalType
extends PrimitiveType<BigDecimal>
implements Comparable<DecimalType>, org.hl7.fhir.instance.model.api.IBaseDecimalDatatype
Primitive type "decimal" in FHIR: A rational number
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConstructorDecimalType(double theValue) ConstructorDecimalType(long theValue) ConstructorDecimalType(String theValue) ConstructorDecimalType(BigDecimal theValue) Constructor -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(DecimalType theObj) copy()protected Stringencode(BigDecimal theValue) Subclasses must override to convert a "coerced" value into an encoded one.fhirType()intGets the value as an integer, usingBigDecimal.intValue()protected BigDecimalSubclasses 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 previsionsetRepresentation(String value) A parser can provide a literal representation for the decimal value that preserves the presented form.voidsetValue(double theValue) Sets a new value using a doublevoidsetValue(long theValue) Sets a new value using a longvoidsetValueAsInteger(int theValue) Sets a new value using an integervoidsetValueAsString(String theString) Methods inherited from class org.hl7.fhir.r4.model.PrimitiveType
asStringValue, equalsDeep, equalsShallow, forceStringValue, fpValue, fromStringValue, getProperty, getTypesForProperty, getValue, getValueAsString, hashCode, hasPrimitiveValue, hasValue, isEmpty, isPrimitive, makeProperty, primitiveValue, readExternal, removeChild, setProperty, setProperty, setValue, toString, typedCopy, updateStringValue, writeExternalMethods inherited from class org.hl7.fhir.r4.model.Element
addChild, addExtension, addExtension, addExtension, copyExtensions, copyNewExtensions, copyValues, getExtension, getExtensionByUrl, getExtensionFirstRep, getExtensionsByUrl, getExtensionsByUrl, getExtensionString, getId, getIdBase, getIdElement, getNamedProperty, hasExtension, hasExtension, hasExtension, hasExtension, hasId, hasIdElement, isDisallowExtensions, listChildren, noExtensions, removeExtension, setDisallowExtensions, setExtension, setId, setIdBase, setIdElementMethods inherited from class org.hl7.fhir.r4.model.Base
castToAddress, castToAnnotation, castToAttachment, castToBase64Binary, castToBoolean, castToCanonical, castToCode, castToCodeableConcept, castToCoding, castToContactDetail, castToContactPoint, castToContributor, castToDataRequirement, castToDate, castToDateTime, castToDecimal, castToDosage, castToDuration, castToElementDefinition, castToExpression, castToExtension, castToHumanName, castToId, castToIdentifier, castToInstant, castToInteger, castToMarkdown, castToMarketingStatus, castToMeta, castToMoney, castToNarrative, castToOid, castToParameterDefinition, castToPeriod, castToPopulation, castToPositiveInt, castToProdCharacteristic, castToProductShelfLife, castToQuantity, castToRange, castToRatio, castToReference, castToRelatedArtifact, castToResource, castToSampledData, castToSignature, castToSimpleQuantity, castToString, castToSubstanceAmount, castToTime, castToTiming, castToTriggerDefinition, castToType, castToUnsignedInt, castToUri, castToUrl, castToUsageContext, castToXhtml, castToXhtmlString, children, clearUserData, compareDeep, compareDeep, compareDeep, compareDeep, compareValues, compareValues, copyValues, dateTimeValue, equals, getChildByName, getChildValueByName, getFormatCommentsPost, getFormatCommentsPre, getNamedProperty, getUserData, getUserInt, getUserString, getXhtml, hasFormatComment, hasType, hasUserData, isBooleanPrimitive, isDateTime, isMetadataBased, isResource, listChildrenByName, listChildrenByName, setUserData, setUserDataINN, setXhtmlMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hl7.fhir.instance.model.api.IBase
getFormatCommentsPost, getFormatCommentsPre, getUserData, hasFormatComment, isEmpty, setUserDataMethods inherited from interface org.hl7.fhir.instance.model.api.IBaseElement
getUserData, setUserDataMethods inherited from interface org.hl7.fhir.instance.model.api.IBaseHasExtensions
addExtension, getExtension, hasExtensionMethods inherited from interface org.hl7.fhir.instance.model.api.IPrimitiveType
getValue, getValueAsString, hasValue, setValue
-
Constructor Details
-
DecimalType
public DecimalType()Constructor -
DecimalType
Constructor -
DecimalType
Constructor -
DecimalType
Constructor -
DecimalType
Constructor
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<DecimalType>
-
encode
Description copied from class:PrimitiveTypeSubclasses must override to convert a "coerced" value into an encoded one.- Specified by:
encodein classPrimitiveType<BigDecimal>- Parameters:
theValue- Will not be null- Returns:
- May return null if the value does not correspond to anything
-
getValueAsInteger
Gets the value as an integer, usingBigDecimal.intValue() -
getValueAsNumber
-
parse
Description copied from class:PrimitiveTypeSubclasses must override to convert an encoded representation of this datatype into a "coerced" one- Specified by:
parsein classPrimitiveType<BigDecimal>- Parameters:
theValue- Will not be null- Returns:
- May return null if the value does not correspond to anything
-
round
Rounds the value to the given prevision- See Also:
-
round
Rounds the value to the given prevision- See Also:
-
setValueAsInteger
Sets a new value using an integer -
setValueAsString
- Specified by:
setValueAsStringin interfaceorg.hl7.fhir.instance.model.api.IPrimitiveType<BigDecimal>- Overrides:
setValueAsStringin classPrimitiveType<BigDecimal>
-
setValue
Sets a new value using a long -
setValue
Sets a new value using a double -
copy
- Specified by:
copyin classPrimitiveType<BigDecimal>
-
fhirType
-
setRepresentation
A parser can provide a literal representation for the decimal value that preserves the presented form. All sorts of bad things can happen if this method is used to set the string representation to anything other than what was parsed into the actual value. Don't do that- Parameters:
value-- Returns:
-