Class DateTimePatternDetector
java.lang.Object
com.northconcepts.datapipeline.foundations.time.DateTimePatternDetector
A utility for parsing date, time, and date-time values from string using a set of possible patterns. New instances come with a predefined set of common patterns that can be cleared and/or appended to.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds the built-in common patterns (new detectors already have them); duplicates are ignored.addPattern(DateTimePattern pattern) Adds a pattern to try after the existing ones; duplicates are ignored.addPattern(String pattern) Adds a case-insensitiveDateTimePatternto try after the existing ones; duplicates are ignored.Returns the live set of patterns, in the order they are tried.booleanisDebug()Indicates if failing patterns should be logged (default false).Returns all the patterns in this detector that successfully parsed the supplied value.matchFirst(String value) Returns the first pattern in this detector that successfully parsed the supplied value.setDebug(boolean debug) Indicates if failing patterns should be logged (default false).
-
Constructor Details
-
DateTimePatternDetector
public DateTimePatternDetector()
-
-
Method Details
-
isDebug
public boolean isDebug()Indicates if failing patterns should be logged (default false). -
setDebug
Indicates if failing patterns should be logged (default false). -
getPatterns
Returns the live set of patterns, in the order they are tried. -
addCommonPatterns
Adds the built-in common patterns (new detectors already have them); duplicates are ignored. -
addPattern
Adds a pattern to try after the existing ones; duplicates are ignored. -
clearPatterns
-
addPattern
Adds a case-insensitiveDateTimePatternto try after the existing ones; duplicates are ignored. -
matchFirst
Returns the first pattern in this detector that successfully parsed the supplied value. -
matchAll
Returns all the patterns in this detector that successfully parsed the supplied value.
-