Interface FormatElement

All Known Implementing Classes:
FormatElementEnum

public interface FormatElement
A format element in a format string. Knows how to parse and unparse itself.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Applies a consumer to a format element.
    format(Date date)
    Formats a date to its appropriate string representation for the element.
    Returns the description of an element.
  • Method Details

    • format

      String format(Date date)
      Formats a date to its appropriate string representation for the element.

      This API is subject to change. It might be more efficient if the signature was one of the following:

         void format(StringBuilder, java.util.Date)
         void format(StringBuilder, long)
       
    • getDescription

      String getDescription()
      Returns the description of an element.

      For example, %H in MySQL represents the hour in 24-hour format (e.g., 00..23). This method returns the string "The hour (24-hour clock) as a decimal number (00-23)", which is the description of FormatElementEnum.HH24.

    • flatten

      default void flatten(Consumer<FormatElement> consumer)
      Applies a consumer to a format element.