Package org.threeten.bp.format
Class DateTimeFormatterBuilder.ReducedPrinterParser
- java.lang.Object
-
- org.threeten.bp.format.DateTimeFormatterBuilder.NumberPrinterParser
-
- org.threeten.bp.format.DateTimeFormatterBuilder.ReducedPrinterParser
-
- All Implemented Interfaces:
DateTimeFormatterBuilder.DateTimePrinterParser
- Enclosing class:
- DateTimeFormatterBuilder
static final class DateTimeFormatterBuilder.ReducedPrinterParser extends DateTimeFormatterBuilder.NumberPrinterParser
Prints and parses a reduced numeric date-time field.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static LocalDateBASE_DATEprivate ChronoLocalDatebaseDateprivate intbaseValue-
Fields inherited from class org.threeten.bp.format.DateTimeFormatterBuilder.NumberPrinterParser
EXCEED_POINTS, field, maxWidth, minWidth, signStyle, subsequentWidth
-
-
Constructor Summary
Constructors Modifier Constructor Description (package private)ReducedPrinterParser(TemporalField field, int width, int maxWidth, int baseValue, ChronoLocalDate baseDate)Constructor.privateReducedPrinterParser(TemporalField field, int minWidth, int maxWidth, int baseValue, ChronoLocalDate baseDate, int subsequentWidth)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) longgetValue(DateTimePrintContext context, long value)Gets the value to output.(package private) booleanisFixedWidth(DateTimeParseContext context)(package private) intsetValue(DateTimeParseContext context, long value, int errorPos, int successPos)Stores the value.java.lang.StringtoString()(package private) DateTimeFormatterBuilder.NumberPrinterParserwithFixedWidth()Returns a new instance with fixed width flag set.(package private) DateTimeFormatterBuilder.ReducedPrinterParserwithSubsequentWidth(int subsequentWidth)Returns a new instance with an updated subsequent width.-
Methods inherited from class org.threeten.bp.format.DateTimeFormatterBuilder.NumberPrinterParser
parse, print
-
-
-
-
Field Detail
-
BASE_DATE
static final LocalDate BASE_DATE
-
baseValue
private final int baseValue
-
baseDate
private final ChronoLocalDate baseDate
-
-
Constructor Detail
-
ReducedPrinterParser
ReducedPrinterParser(TemporalField field, int width, int maxWidth, int baseValue, ChronoLocalDate baseDate)
Constructor.- Parameters:
field- the field to print, validated not nullwidth- the field width, from 1 to 10maxWidth- the field max width, from 1 to 10baseValue- the base valuebaseDate- the base date
-
ReducedPrinterParser
private ReducedPrinterParser(TemporalField field, int minWidth, int maxWidth, int baseValue, ChronoLocalDate baseDate, int subsequentWidth)
-
-
Method Detail
-
getValue
long getValue(DateTimePrintContext context, long value)
Description copied from class:DateTimeFormatterBuilder.NumberPrinterParserGets the value to output.- Overrides:
getValuein classDateTimeFormatterBuilder.NumberPrinterParser- Parameters:
context- the contextvalue- the value of the field, not null- Returns:
- the value
-
setValue
int setValue(DateTimeParseContext context, long value, int errorPos, int successPos)
Description copied from class:DateTimeFormatterBuilder.NumberPrinterParserStores the value.- Overrides:
setValuein classDateTimeFormatterBuilder.NumberPrinterParser- Parameters:
context- the context to store into, not nullvalue- the valueerrorPos- the position of the field being parsedsuccessPos- the position after the field being parsed- Returns:
- the new position
-
withFixedWidth
DateTimeFormatterBuilder.NumberPrinterParser withFixedWidth()
Description copied from class:DateTimeFormatterBuilder.NumberPrinterParserReturns a new instance with fixed width flag set.- Overrides:
withFixedWidthin classDateTimeFormatterBuilder.NumberPrinterParser- Returns:
- a new updated printer-parser, not null
-
withSubsequentWidth
DateTimeFormatterBuilder.ReducedPrinterParser withSubsequentWidth(int subsequentWidth)
Description copied from class:DateTimeFormatterBuilder.NumberPrinterParserReturns a new instance with an updated subsequent width.- Overrides:
withSubsequentWidthin classDateTimeFormatterBuilder.NumberPrinterParser- Parameters:
subsequentWidth- the width of subsequent non-negative numbers, 0 or greater- Returns:
- a new updated printer-parser, not null
-
isFixedWidth
boolean isFixedWidth(DateTimeParseContext context)
- Overrides:
isFixedWidthin classDateTimeFormatterBuilder.NumberPrinterParser
-
toString
public java.lang.String toString()
- Overrides:
toStringin classDateTimeFormatterBuilder.NumberPrinterParser
-
-