Class QuantityValueImpl
java.lang.Object
org.wikidata.wdtk.datamodel.implementation.ValueImpl
org.wikidata.wdtk.datamodel.implementation.QuantityValueImpl
- All Implemented Interfaces:
QuantityValue
,Value
Jackson implementation of
QuantityValue
.- Author:
- Fredo Erxleben, Antonin Delpeuch
-
Field Summary
Fields inherited from class org.wikidata.wdtk.datamodel.implementation.ValueImpl
JSON_VALUE_TYPE_ENTITY_ID, JSON_VALUE_TYPE_GLOBE_COORDINATES, JSON_VALUE_TYPE_MONOLINGUAL_TEXT, JSON_VALUE_TYPE_QUANTITY, JSON_VALUE_TYPE_STRING, JSON_VALUE_TYPE_TIME
-
Constructor Summary
ConstructorDescriptionQuantityValueImpl
(BigDecimal numericValue, BigDecimal lowerBound, BigDecimal upperBound, String unit) Deprecated.supply the unit as an ItemIdValue insteadQuantityValueImpl
(BigDecimal numericValue, BigDecimal lowerBound, BigDecimal upperBound, ItemIdValue unit) Constructor. -
Method Summary
Modifier and TypeMethodDescription<T> T
accept
(ValueVisitor<T> valueVisitor) Accept a ValueVisitor and return its output.boolean
Returns the upper bound for the numeric value of this quantity.Returns the main numeric value of this quantity.getUnit()
Returns the unit of this quantity, or the string "1" if there is no unit.Returns the upper bound for the numeric value of this quantity.org.wikidata.wdtk.datamodel.implementation.QuantityValueImpl.JacksonInnerQuantity
getValue()
Returns the inner value helper object.int
hashCode()
toString()
-
Constructor Details
-
QuantityValueImpl
public QuantityValueImpl(BigDecimal numericValue, BigDecimal lowerBound, BigDecimal upperBound, ItemIdValue unit) Constructor.- Parameters:
numericValue
- the numeric value of this quantitylowerBound
- the lower bound of the numeric value of this quantity or null if not setupperBound
- the upper bound of the numeric value of this quantity or null if not setunit
- the unit of this quantity, or null if there is no unit
-
QuantityValueImpl
@Deprecated public QuantityValueImpl(BigDecimal numericValue, BigDecimal lowerBound, BigDecimal upperBound, String unit) Deprecated.supply the unit as an ItemIdValue insteadConstructor.- Parameters:
numericValue
- the numeric value of this quantitylowerBound
- the lower bound of the numeric value of this quantity or null if not setupperBound
- the upper bound of the numeric value of this quantity or null if not setunit
- the unit of this quantity, or the empty string if there is no unit
-
-
Method Details
-
getValue
public org.wikidata.wdtk.datamodel.implementation.QuantityValueImpl.JacksonInnerQuantity getValue()Returns the inner value helper object. Only for use by Jackson during serialization.- Returns:
- the inner quantity value
-
getNumericValue
Description copied from interface:QuantityValue
Returns the main numeric value of this quantity.- Specified by:
getNumericValue
in interfaceQuantityValue
- Returns:
- numeric value as a decimal value of arbitrary precision
-
getLowerBound
Description copied from interface:QuantityValue
Returns the upper bound for the numeric value of this quantity.- Specified by:
getLowerBound
in interfaceQuantityValue
- Returns:
- numeric value as a decimal value of arbitrary precision or null if not set
-
getUpperBound
Description copied from interface:QuantityValue
Returns the upper bound for the numeric value of this quantity.- Specified by:
getUpperBound
in interfaceQuantityValue
- Returns:
- numeric value as a decimal value of arbitrary precision or null if not set
-
getUnit
Description copied from interface:QuantityValue
Returns the unit of this quantity, or the string "1" if there is no unit. Units are typically encoded as entity IRIs.- Specified by:
getUnit
in interfaceQuantityValue
- Returns:
- unit string (IRI or the string "1" if there is no unit)
-
getUnitItemId
- Specified by:
getUnitItemId
in interfaceQuantityValue
- Returns:
- the unit of this quantity as an item id value, or null if there is no unit.
-
accept
Description copied from interface:Value
Accept a ValueVisitor and return its output. -
hashCode
public int hashCode() -
equals
-
toString
-