Class PadPrinterParserDecorator

    • Field Detail

      • padWidth

        private final int padWidth
        The width to pad the next field to.
      • padChar

        private final char padChar
        The character to pad the next field with.
    • Constructor Detail

      • PadPrinterParserDecorator

        PadPrinterParserDecorator​(DateTimePrinter printer,
                                  DateTimeParser parser,
                                  int padWidth,
                                  char padChar)
        Constructor.
        Parameters:
        printer - the printer, may be null in which case print() must not be called
        parser - the parser, may be null in which case parse() must not be called
        padWidth - the width to pad to, 1 or greater
        padChar - the pad character
    • Method Detail

      • print

        public void print​(Calendrical calendrical,
                          java.lang.Appendable appendable,
                          DateTimeFormatSymbols symbols)
                   throws java.io.IOException
        Prints the calendrical object to the appendable.
        Specified by:
        print in interface DateTimePrinter
        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:
        java.io.IOException - if the append throws an exception
      • isPrintDataAvailable

        public 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.

        Specified by:
        isPrintDataAvailable in interface DateTimePrinter
        Parameters:
        calendrical - the calendrical to check, not null
        Returns:
        true if the calendrical can be printed, false if not
      • parse

        public int parse​(DateTimeParseContext context,
                         java.lang.String parseText,
                         int position)
        Parses from the supplied text and position into the calendrical.
        Specified by:
        parse in interface DateTimeParser
        Parameters:
        context - the context to use and parse into, not null
        parseText - the input text to parse, not null
        position - the position to start parsing at, from 0 to the text length
        Returns:
        the new parse position, where negative means an error with the error position encoded using the complement ~ operator
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object