javax.time.calendar.format
Interface DateTimePrinter


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.

This interface must be implemented with care to ensure other classes in the framework operate correctly. All implementations that can be instantiated must be final, immutable and thread-safe.

The context is not a thread-safe object and a new instance will be created for each print that occurs. The context must not be stored in an instance variable or shared with any other threads.

Author:
Stephen Colebourne

Method Summary
 boolean print(DateTimePrintContext context, java.lang.StringBuilder buf)
          Prints the calendrical object to the buffer.
 

Method Detail

print

boolean print(DateTimePrintContext context,
              java.lang.StringBuilder buf)
Prints the calendrical object to the buffer.

The context holds information to use during the print. It also contains the calendrical information to be printed.

The buffer must not be mutated beyond the content controlled by the implementation.

Parameters:
context - the context to print using, not null
buf - the buffer to append to, not null
Returns:
false if unable to query the value from the calendrical, true otherwise
Throws:
CalendricalException - if the calendrical cannot be printed successfully