DateTimeFormatterBuilder.parseDefaulting

Appends a default value for a field to the formatter for use _in parsing. !(p) This appends an instruction to the builder to inject a default value into the parsed result. This is especially useful _in conjunction with optional parts of the formatter. !(p) For example, consider a formatter that parses the year, followed by an optional month, with a further optional day-of-month. Using such a formatter would require the calling code to check whether a full date, year-month or just a year had been parsed. This method can be used to default the month and day-of-month to a sensible value, such as the first of the month, allowing the calling code to always get a date. !(p) During formatting, this method has no effect. !(p) During parsing, the current state of the parse is inspected. If the specified field has no associated value, because it has not been parsed successfully at that point, then the specified value is injected into the parse result. Injection is immediate, thus the field-value pair will be visible to any subsequent elements _in the formatter. As such, this method is normally called at the end of the builder.

@param field the field to default the value of, not null @param value the value to default the field to @return this, for chaining, not null

class DateTimeFormatterBuilder
parseDefaulting

Meta