Class QuantityValueImpl

java.lang.Object
org.wikidata.wdtk.datamodel.implementation.ValueImpl
org.wikidata.wdtk.datamodel.implementation.QuantityValueImpl
All Implemented Interfaces:
QuantityValue, Value

public class QuantityValueImpl extends ValueImpl implements QuantityValue
Jackson implementation of QuantityValue.
Author:
Fredo Erxleben, Antonin Delpeuch
  • Constructor Details

    • QuantityValueImpl

      public QuantityValueImpl(BigDecimal numericValue, BigDecimal lowerBound, BigDecimal upperBound, ItemIdValue unit)
      Constructor.
      Parameters:
      numericValue - the numeric value of this quantity
      lowerBound - the lower bound of the numeric value of this quantity or null if not set
      upperBound - the upper bound of the numeric value of this quantity or null if not set
      unit - 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 instead
      Constructor.
      Parameters:
      numericValue - the numeric value of this quantity
      lowerBound - the lower bound of the numeric value of this quantity or null if not set
      upperBound - the upper bound of the numeric value of this quantity or null if not set
      unit - 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

      public BigDecimal getNumericValue()
      Description copied from interface: QuantityValue
      Returns the main numeric value of this quantity.
      Specified by:
      getNumericValue in interface QuantityValue
      Returns:
      numeric value as a decimal value of arbitrary precision
    • getLowerBound

      public BigDecimal getLowerBound()
      Description copied from interface: QuantityValue
      Returns the upper bound for the numeric value of this quantity.
      Specified by:
      getLowerBound in interface QuantityValue
      Returns:
      numeric value as a decimal value of arbitrary precision or null if not set
    • getUpperBound

      public BigDecimal getUpperBound()
      Description copied from interface: QuantityValue
      Returns the upper bound for the numeric value of this quantity.
      Specified by:
      getUpperBound in interface QuantityValue
      Returns:
      numeric value as a decimal value of arbitrary precision or null if not set
    • getUnit

      public String 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 interface QuantityValue
      Returns:
      unit string (IRI or the string "1" if there is no unit)
    • getUnitItemId

      public ItemIdValue getUnitItemId()
      Specified by:
      getUnitItemId in interface QuantityValue
      Returns:
      the unit of this quantity as an item id value, or null if there is no unit.
    • accept

      public <T> T accept(ValueVisitor<T> valueVisitor)
      Description copied from interface: Value
      Accept a ValueVisitor and return its output.
      Specified by:
      accept in interface Value
      Parameters:
      valueVisitor - the ValueVisitor
      Returns:
      output of the visitor
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object