Package org.threeten.bp.format
Class DateTimeFormatterBuilder.TextPrinterParser
- java.lang.Object
-
- org.threeten.bp.format.DateTimeFormatterBuilder.TextPrinterParser
-
- All Implemented Interfaces:
DateTimeFormatterBuilder.DateTimePrinterParser
- Enclosing class:
- DateTimeFormatterBuilder
static final class DateTimeFormatterBuilder.TextPrinterParser extends java.lang.Object implements DateTimeFormatterBuilder.DateTimePrinterParser
Prints or parses field text.
-
-
Field Summary
Fields Modifier and Type Field Description private TemporalFieldfieldprivate DateTimeFormatterBuilder.NumberPrinterParsernumberPrinterParserThe cached number printer parser.private DateTimeTextProviderproviderprivate TextStyletextStyle
-
Constructor Summary
Constructors Constructor Description TextPrinterParser(TemporalField field, TextStyle textStyle, DateTimeTextProvider provider)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private DateTimeFormatterBuilder.NumberPrinterParsernumberPrinterParser()Create and cache a number printer parser.intparse(DateTimeParseContext context, java.lang.CharSequence parseText, int position)Parses text into date-time information.booleanprint(DateTimePrintContext context, java.lang.StringBuilder buf)Prints the date-time object to the buffer.java.lang.StringtoString()
-
-
-
Field Detail
-
field
private final TemporalField field
-
textStyle
private final TextStyle textStyle
-
provider
private final DateTimeTextProvider provider
-
numberPrinterParser
private volatile DateTimeFormatterBuilder.NumberPrinterParser numberPrinterParser
The cached number printer parser. Immutable and volatile, so no synchronization needed.
-
-
Constructor Detail
-
TextPrinterParser
TextPrinterParser(TemporalField field, TextStyle textStyle, DateTimeTextProvider provider)
Constructor.- Parameters:
field- the field to output, not nulltextStyle- the text style, not nullprovider- the text provider, not null
-
-
Method Detail
-
print
public boolean print(DateTimePrintContext context, java.lang.StringBuilder buf)
Description copied from interface:DateTimeFormatterBuilder.DateTimePrinterParserPrints the date-time object to the buffer.The context holds information to use during the print. It also contains the date-time information to be printed.
The buffer must not be mutated beyond the content controlled by the implementation.
- Specified by:
printin interfaceDateTimeFormatterBuilder.DateTimePrinterParser- Parameters:
context- the context to print using, not nullbuf- the buffer to append to, not null- Returns:
- false if unable to query the value from the date-time, true otherwise
-
parse
public int parse(DateTimeParseContext context, java.lang.CharSequence parseText, int position)
Description copied from interface:DateTimeFormatterBuilder.DateTimePrinterParserParses text into date-time information.The context holds information to use during the parse. It is also used to store the parsed date-time information.
- Specified by:
parsein interfaceDateTimeFormatterBuilder.DateTimePrinterParser- Parameters:
context- the context to use and parse into, not nullparseText- the input text to parse, not nullposition- 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
-
numberPrinterParser
private DateTimeFormatterBuilder.NumberPrinterParser numberPrinterParser()
Create and cache a number printer parser.- Returns:
- the number printer parser for this field, not null
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-