Class AbstractQuantityFormat

    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.text.Format

        java.text.Format.Field
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long serialVersionUID  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.StringBuffer format​(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)  
      abstract java.lang.Appendable format​(javax.measure.Quantity<?> quantity, java.lang.Appendable dest)
      Formats the specified quantity into an Appendable.
      java.lang.StringBuilder format​(AbstractQuantity<?> quantity, java.lang.StringBuilder dest)
      Convenience method equivalent to #format(AbstractQuantity, Appendable) except it does not raise an IOException.
      abstract ComparableQuantity<?> parse​(java.lang.CharSequence csq)
      Parses a portion of the specified CharSequence from the specified position to produce an object.
      (package private) abstract ComparableQuantity<?> parse​(java.lang.CharSequence csq, int index)
      Parses a portion of the specified CharSequence from the specified position to produce an object.
      abstract ComparableQuantity<?> parse​(java.lang.CharSequence csq, java.text.ParsePosition cursor)
      Parses a portion of the specified CharSequence from the specified position to produce an object.
      javax.measure.Quantity<?> parseObject​(java.lang.String source, java.text.ParsePosition pos)  
      • Methods inherited from class java.text.Format

        clone, format, formatToCharacterIterator, parseObject
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractQuantityFormat

        public AbstractQuantityFormat()
    • Method Detail

      • format

        public abstract java.lang.Appendable format​(javax.measure.Quantity<?> quantity,
                                                    java.lang.Appendable dest)
                                             throws java.io.IOException
        Formats the specified quantity into an Appendable.
        Specified by:
        format in interface QuantityFormat
        Parameters:
        quantity - the quantity to format.
        dest - the appendable destination.
        Returns:
        the specified Appendable.
        Throws:
        java.io.IOException - if an I/O exception occurs.
      • parse

        public abstract ComparableQuantity<?> parse​(java.lang.CharSequence csq,
                                                    java.text.ParsePosition cursor)
                                             throws java.lang.IllegalArgumentException,
                                                    javax.measure.format.ParserException
        Parses a portion of the specified CharSequence from the specified position to produce an object. If parsing succeeds, then the index of the cursor argument is updated to the index after the last character used.
        Specified by:
        parse in interface QuantityFormat
        Parameters:
        csq - the CharSequence to parse.
        cursor - the cursor holding the current parsing index.
        Returns:
        the object parsed from the specified character sub-sequence.
        Throws:
        java.lang.IllegalArgumentException - if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).
        javax.measure.format.ParserException
      • parse

        public abstract ComparableQuantity<?> parse​(java.lang.CharSequence csq)
                                             throws javax.measure.format.ParserException
        Parses a portion of the specified CharSequence from the specified position to produce an object. If parsing succeeds, then the index of the cursor argument is updated to the index after the last character used.
        Specified by:
        parse in interface tech.uom.lib.common.function.Parser<java.lang.CharSequence,​ComparableQuantity>
        Specified by:
        parse in interface QuantityFormat
        Parameters:
        csq - the CharSequence to parse.
        cursor - the cursor holding the current parsing index.
        Returns:
        the object parsed from the specified character sub-sequence.
        Throws:
        java.lang.IllegalArgumentException - if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).
        javax.measure.format.ParserException
      • parse

        abstract ComparableQuantity<?> parse​(java.lang.CharSequence csq,
                                             int index)
                                      throws java.lang.IllegalArgumentException,
                                             javax.measure.format.ParserException
        Parses a portion of the specified CharSequence from the specified position to produce an object. If parsing succeeds, then the index of the cursor argument is updated to the index after the last character used.
        Parameters:
        csq - the CharSequence to parse.
        index - the current parsing index.
        Returns:
        the object parsed from the specified character sub-sequence.
        Throws:
        java.lang.IllegalArgumentException - if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).
        javax.measure.format.ParserException
      • format

        public final java.lang.StringBuffer format​(java.lang.Object obj,
                                                   java.lang.StringBuffer toAppendTo,
                                                   java.text.FieldPosition pos)
        Specified by:
        format in class java.text.Format
      • parseObject

        public final javax.measure.Quantity<?> parseObject​(java.lang.String source,
                                                           java.text.ParsePosition pos)
        Specified by:
        parseObject in class java.text.Format
      • format

        public final java.lang.StringBuilder format​(AbstractQuantity<?> quantity,
                                                    java.lang.StringBuilder dest)
        Convenience method equivalent to #format(AbstractQuantity, Appendable) except it does not raise an IOException.
        Parameters:
        quantity - the quantity to format.
        dest - the appendable destination.
        Returns:
        the specified StringBuilder.