Class QuantityConverter

  • All Implemented Interfaces:
    StringConverter<javax.measure.Quantity<?>>

    public class QuantityConverter
    extends Object
    implements StringConverter<javax.measure.Quantity<?>>
    Converts an Amount to and from a String representation.
    Author:
    Nick Collier
    • Constructor Detail

      • QuantityConverter

        public QuantityConverter()
    • Method Detail

      • toString

        public String toString​(javax.measure.Quantity<?> quantity)
        Converts the specified object to a String representation and returns that representation. The represenation should be such that fromString can recreate the Object.
        Specified by:
        toString in interface StringConverter<javax.measure.Quantity<?>>
        Parameters:
        obj - the Object to convert.
        Returns:
        a String representation of the Object.
      • fromString

        public javax.measure.Quantity<?> fromString​(String strRep)
        Creates an Object from a String representation.
        Specified by:
        fromString in interface StringConverter<javax.measure.Quantity<?>>
        Parameters:
        strRep - the string representation
        Returns:
        the created Object.