Interface DateTimePrinter

All Known Implementing Classes:
CaseSensitivePrinterParser, CharLiteralPrinterParser, CompositePrinterParser, FractionPrinterParser, LocalizedPrinterParser, NumberPrinterParser, PadPrinterParserDecorator, ReducedPrinterParser, StrictLenientPrinterParser, StringLiteralPrinterParser, TextPrinterParser, ZoneOffsetPrinterParser, ZonePrinterParser

public interface DateTimePrinter
Strategy for printing a calendrical to an appendable.

The printer may print any part, or the whole, of the input Calendrical. Typically, a complete print is constructed from a number of smaller units, each outputting a single field.

DateTimePrinter is an interface and must be implemented with care to ensure other classes in the framework operate correctly. All instantiable implementations must be final, immutable and thread-safe.

  • Method Details

    • print

      void print(Calendrical calendrical, Appendable appendable, DateTimeFormatSymbols symbols) throws IOException
      Prints the calendrical object to the appendable.
      Parameters:
      calendrical - the calendrical to print, not null
      appendable - the appendable to add to, not null
      symbols - the formatting symbols to use, not null
      Throws:
      CalendricalPrintException - if the date time cannot be printed successfully
      IOException - if the append throws an exception
    • isPrintDataAvailable

      boolean isPrintDataAvailable(Calendrical calendrical)
      Checks if the calendrical contains the data necessary to be printed.

      The implementation should not check the validity of the data, just whether there is sufficient data to attempt a print.

      Parameters:
      calendrical - the calendrical to check, not null
      Returns:
      true if the calendrical can be printed, false if not