Interface IDisplayable

  • All Known Subinterfaces:
    IQuantity, IRange<T>, ITypedQuantity<U>
    All Known Implementing Classes:
    QuantityRange

    public interface IDisplayable
    Interface for objects that can be formatted for human display purposes, using a formatting hint.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String AUTO
      Identifier for formatters suitable when many items are typically shown, such as tables, overviews, etc.
      static String EXACT
      Identifier for formatters which shows the value with maximum known precision, but still only as one value.
      static String VERBOSE
      Identifier for formatters suitable for tool tips.
    • Field Detail

      • AUTO

        static final String AUTO
        Identifier for formatters suitable when many items are typically shown, such as tables, overviews, etc. Relatively compact, but not overly so. Using reasonable precision for at-a-glance display. Such a formatter is expected to exist for all IDisplayable implementations.
        See Also:
        Constant Field Values
      • EXACT

        static final String EXACT
        Identifier for formatters which shows the value with maximum known precision, but still only as one value. For quantities, this will often be similar to IQuantity.interactiveFormat(), but tweaked for display, such as using non-breaking space between number and unit, and in applicable locales, between number groups. Also, not always parsable constructs like custom units may be used.
        See Also:
        Constant Field Values
      • VERBOSE

        static final String VERBOSE
        Identifier for formatters suitable for tool tips. For quantities, in addition to showing the exact value, like EXACT, the value may additionally be displayed in different units.
        See Also:
        Constant Field Values
    • Method Detail

      • displayUsing

        String displayUsing​(String formatHint)
        Format this object for display purposes, preferably using the formatter hinted by formatHint. If no such formatter is defined for this type, the default formatter will be used.
        Parameters:
        formatHint - the format hint
        Returns:
        a formatted string according to the hinted (or default) formatter