public class CustomizedTextDateParser extends Object implements TemporalParser, Serializable
parse
method.
If the ISO format parsing process fails, use orderings
formatters to parse the date.
Constructor and Description |
---|
CustomizedTextDateParser() |
Modifier and Type | Method and Description |
---|---|
static TemporalParser |
getInstance(DateComponentOrdering[] orderings) |
ParseResult<TemporalAccessor> |
parse(Integer year,
Integer dayOfYear)
Parse year, dayOfYear integers as a TemporalAccessor.
|
ParseResult<TemporalAccessor> |
parse(Integer year,
Integer month,
Integer day)
Parse year, month, day integers as a TemporalAccessor.
|
ParseResult<TemporalAccessor> |
parse(String input)
Parse a date represented as a single String into a TemporalAccessor.
|
ParseResult<TemporalAccessor> |
parse(String input,
DateComponentOrdering ordering)
Parse a String date restricted to the
ordering provided. |
ParseResult<TemporalAccessor> |
parse(String input,
DateComponentOrdering[] orderings)
Parse a String date to a TemporalAccessor, attempting unambiguous formats and the
orderings provided. |
ParseResult<TemporalAccessor> |
parse(String year,
String dayOfYear)
Parse year, dayOfYear strings as a TemporalAccessor.
|
ParseResult<TemporalAccessor> |
parse(String year,
String month,
String day)
Parse year, month, day strings as a TemporalAccessor.
|
public CustomizedTextDateParser()
public static TemporalParser getInstance(DateComponentOrdering[] orderings)
orderings
- a set of DateTimeFormatterspublic ParseResult<TemporalAccessor> parse(String input)
TemporalParser
parse
in interface Parsable<TemporalAccessor>
parse
in interface TemporalParser
input
- To parsepublic ParseResult<TemporalAccessor> parse(String input, @Nullable DateComponentOrdering ordering)
TemporalParser
ordering
provided.
Set a general date ordering for the parsing. For example, DMY will support both 14.08.2020 and
14/08/2020, but not 2020-08-14 or 08/14/2020.
NOTE, this behaviour differs from TemporalParser.parse(String, DateComponentOrdering[])
.parse
in interface TemporalParser
ordering
- required date ordering.public ParseResult<TemporalAccessor> parse(String input, @Nullable DateComponentOrdering[] orderings)
TemporalParser
orderings
provided.
The date 2020-08-14 will always parse. An ordering
of DMY_FORMATS will also
support 14.08.2020, 14/08/2020 and 14/08/2020 14:11:00, but not 08/14/2020.
NOTE, this behaviour differs from TemporalParser.parse(String, DateComponentOrdering)
.parse
in interface TemporalParser
orderings
- required general date orderingspublic ParseResult<TemporalAccessor> parse(@Nullable String year, @Nullable String month, @Nullable String day)
TemporalParser
parse
in interface TemporalParser
year
- numerical value of a yearmonth
- value of the mont depending on the implementation, numerical value of a
month (starting at 1 for January) or possibly text.day
- numerical value of a daypublic ParseResult<TemporalAccessor> parse(@Nullable Integer year, @Nullable Integer month, @Nullable Integer day)
TemporalParser
parse
in interface TemporalParser
year
- numerical value of a yearmonth
- numerical value of a month (starting at 1 for January)day
- numerical value of a daypublic ParseResult<TemporalAccessor> parse(@Nullable String year, @Nullable String dayOfYear)
TemporalParser
parse
in interface TemporalParser
year
- numerical value of a yeardayOfYear
- numerical value of a day of the yearpublic ParseResult<TemporalAccessor> parse(@Nullable Integer year, @Nullable Integer dayOfYear)
TemporalParser
parse
in interface TemporalParser
year
- numerical value of a yeardayOfYear
- numerical value of a day of the yearCopyright © 2024 Global Biodiversity Information Facility (GBIF). All rights reserved.