Package com.ethlo.time.token
Class ConfigurableDateTimeParser
- java.lang.Object
-
- com.ethlo.time.token.ConfigurableDateTimeParser
-
- All Implemented Interfaces:
DateTimeParser
public class ConfigurableDateTimeParser extends java.lang.Object implements DateTimeParser
A configurable format `DateTimeParser`.
-
-
Field Summary
Fields Modifier and Type Field Description private DateTimeToken[]
tokens
-
Constructor Summary
Constructors Modifier Constructor Description private
ConfigurableDateTimeParser(DateTimeToken... tokens)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private DateTime
doParse(java.lang.String text, java.text.ParsePosition parsePosition)
static DateTimeParser
of(DateTimeToken... tokens)
Create a new parser with the specified tokensDateTime
parse(java.lang.String text, java.text.ParsePosition parsePosition)
Parse the text from the given position of the parsePositionprivate int
scale(int value, int length)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.ethlo.time.DateTimeParser
parse
-
-
-
-
Field Detail
-
tokens
private final DateTimeToken[] tokens
-
-
Constructor Detail
-
ConfigurableDateTimeParser
private ConfigurableDateTimeParser(DateTimeToken... tokens)
-
-
Method Detail
-
of
public static DateTimeParser of(DateTimeToken... tokens)
Create a new parser with the specified tokens- Parameters:
tokens
- The tokens expected in the format- Returns:
- A new parser instance
-
parse
public DateTime parse(java.lang.String text, java.text.ParsePosition parsePosition)
Description copied from interface:DateTimeParser
Parse the text from the given position of the parsePosition- Specified by:
parse
in interfaceDateTimeParser
- Parameters:
text
- The text to parseparsePosition
- The position in which to start- Returns:
- A DateTime holding the parsed data
-
doParse
private DateTime doParse(java.lang.String text, java.text.ParsePosition parsePosition)
-
scale
private int scale(int value, int length)
-
-