Class FloatFormat

All Implemented Interfaces:
Alignable
Direct Known Subclasses:
ExponentFormat

public class FloatFormat extends NumberFormat
  • Field Details

    • numpre

      protected boolean numpre
  • Constructor Details

    • FloatFormat

      public FloatFormat()
  • Method Details

    • create

      public static FloatFormat create(String format, Locale locale) throws SpecParsingException
      Creates the proper FloatFormat object according to format.
      Parameters:
      format - the format
      locale - the locale for symbols.
      Returns:
      the FloatFormat object for format
      Throws:
      SpecParsingException - if the format is not known.
    • create

      public static FloatFormat create(String format, DecimalFormatSymbols symbols) throws SpecParsingException
      Creates the proper FloatFormat object according to format.
      Parameters:
      format - the format
      symbols - the symbols to use in decimal formatting.
      Returns:
      the FloatFormat object for format
      Throws:
      SpecParsingException - if the format is not known.
    • setFlag

      protected boolean setFlag(char flag, int i)
      Description copied from class: ObjectFormat
      Sets the flags specific to this Class.
      Overrides:
      setFlag in class NumberFormat
      Parameters:
      flag - the flag
      i - the position of the flag in the flags String
      Returns:
      true if the flag was understood, false otherwise.
    • format

      public String format(Object o)
      Description copied from class: ObjectFormat
      Formats an object according to the format specification set by setFormat.

      Must be overriden by subclasses.

      Specified by:
      format in class ObjectFormat
      Parameters:
      o - the object to be formatted.
      Returns:
      a string with the formatted object.
    • setDecimalFormatSymbols

      public void setDecimalFormatSymbols(DecimalFormatSymbols symbols)
      Sets the decimal format symbols. The symbols are generally locale-dependent.
      Parameters:
      symbols - the new DecimalFormatSymbols
    • getDecimalFormatSymbols

      public DecimalFormatSymbols getDecimalFormatSymbols()
      Gets the decimal format symbols.
      Returns:
      the DecimalFormatSymbols
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • sample

      public Object sample()
      Description copied from class: ObjectFormat
      Produce a sample of this format.
      Specified by:
      sample in class ObjectFormat
      Returns:
      a String with a (more or less) random object appropriate to be formatted according to current format specifications.