Package com.cobber.fta.dates
Class DateTimeParserResult
- java.lang.Object
-
- com.cobber.fta.dates.DateTimeParserResult
-
public class DateTimeParserResult extends java.lang.Object
DateTimeParserResult is the result of aDateTimeParser
analysis.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.Boolean
amPmIndicator
int
dateElements
int[]
dateFieldLengths
int[]
dateFieldOffsets
int[]
dateFieldPad
java.lang.Character
dateSeparator
java.lang.Character
dateTimeSeparator
int
dayOffset
int
monthOffset
int
timeElements
int[]
timeFieldLengths
int[]
timeFieldOffsets
int[]
timeFieldPad
java.lang.Boolean
timeFirst
java.lang.String
timeZone
java.util.List<com.cobber.fta.dates.FormatterToken>
tokenized
int
yearOffset
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DateTimeParserResult
asResult(java.lang.String formatString, DateTimeParser.DateResolutionMode resolutionMode, java.util.Locale locale)
Given an input string with a DateTimeFormatter pattern convert to a DateTimeParserResultjava.lang.String
getFormatString()
Return a DateTimeFormatter representation of the DateTimeParserResult.java.lang.String
getRegExp()
Return the Regular Expression that matches this Date/Time object.FTAType
getType()
Return the detected type of this input.protected boolean
isDateUnbound()
boolean
isValid(java.lang.String input)
Determine whether a string input matches this DateTimeParserResult.boolean
isValid8(java.lang.String input)
Determine whether a string input matches this DateTimeParserResult.static DateTimeParserResult
newInstance(DateTimeParserResult r)
void
parse(java.lang.String input)
Determine whether a string input matches this DateTimeParserResult.void
updateFormatString(java.lang.String formatString)
-
-
-
Field Detail
-
timeElements
public int timeElements
-
dateElements
public int dateElements
-
timeFirst
public java.lang.Boolean timeFirst
-
dateTimeSeparator
public java.lang.Character dateTimeSeparator
-
yearOffset
public int yearOffset
-
monthOffset
public int monthOffset
-
dayOffset
public int dayOffset
-
dateFieldLengths
public int[] dateFieldLengths
-
dateFieldOffsets
public int[] dateFieldOffsets
-
dateFieldPad
public int[] dateFieldPad
-
timeFieldLengths
public int[] timeFieldLengths
-
timeFieldOffsets
public int[] timeFieldOffsets
-
timeFieldPad
public int[] timeFieldPad
-
timeZone
public java.lang.String timeZone
-
dateSeparator
public java.lang.Character dateSeparator
-
amPmIndicator
public java.lang.Boolean amPmIndicator
-
tokenized
public java.util.List<com.cobber.fta.dates.FormatterToken> tokenized
-
-
Method Detail
-
newInstance
public static DateTimeParserResult newInstance(DateTimeParserResult r)
-
isDateUnbound
protected boolean isDateUnbound()
-
updateFormatString
public void updateFormatString(java.lang.String formatString)
-
isValid8
public boolean isValid8(java.lang.String input)
Determine whether a string input matches this DateTimeParserResult.- Parameters:
input
- The string to validate (stripped of whitespace.- Returns:
- A boolean indicating if the input is valid.
-
isValid
public boolean isValid(java.lang.String input)
Determine whether a string input matches this DateTimeParserResult.- Parameters:
input
- The string to validate (stripped of whitespace.- Returns:
- A boolean indicating if the input is valid.
-
asResult
public static DateTimeParserResult asResult(java.lang.String formatString, DateTimeParser.DateResolutionMode resolutionMode, java.util.Locale locale)
Given an input string with a DateTimeFormatter pattern convert to a DateTimeParserResult- Parameters:
formatString
- A DateTimeString using DateTimeFormatter patternsresolutionMode
- When we have ambiguity - should we prefer to conclude day first, month first or unspecifiedlocale
- Locale the input string is in- Returns:
- The corresponding DateTimeParserResult
-
parse
public void parse(java.lang.String input)
Determine whether a string input matches this DateTimeParserResult.- Parameters:
input
- The string to validate (stripped of whitespace).- Throws:
java.time.format.DateTimeParseException
- If the input does not match the DateTimeParserResult Note: This routine is akin to the parse() methods on LocalDateTime/ZonedDateTime etc. but runs faster and does not return an instance of the LocalDateTime/ZonedDateTime etc.
-
getType
public FTAType getType()
Return the detected type of this input.- Returns:
- The detected type of this input, will be either "Date", "Time", "DateTime", "ZonedDateTime" or "OffsetDateTime".
-
getRegExp
public java.lang.String getRegExp()
Return the Regular Expression that matches this Date/Time object. All valid inputs should match this Regular Expression, however, not all inputs that match this RE are necessarily valid. For example, 28/13/2017 will match the RE (\d{2}/\d{2}/\d{4}) however this is not a valid date with pattern dd/MM/yyyy.- Returns:
- The Regular Expression that mirrors this Date/Time object.
-
getFormatString
public java.lang.String getFormatString()
Return a DateTimeFormatter representation of the DateTimeParserResult.- Returns:
- A String representation using DateTimeFormatter semantics.
-
-