Package org.sqlite.date
Class FastDateParser.NumberStrategy
java.lang.Object
org.sqlite.date.FastDateParser.Strategy
org.sqlite.date.FastDateParser.NumberStrategy
- Enclosing class:
FastDateParser
A strategy that handles a number field in the parsing pattern
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) boolean
addRegex
(FastDateParser parser, StringBuilder regex) Generate aPattern
regular expression to theStringBuilder
which will accept this field(package private) boolean
isNumber()
Is this field a number? The default implementation returns false.(package private) int
modify
(int iValue) Make any modifications to parsed integer(package private) void
setCalendar
(FastDateParser parser, Calendar cal, String value) Set the Calendar with the parsed field.
-
Field Details
-
field
private final int field
-
-
Constructor Details
-
NumberStrategy
NumberStrategy(int field) Construct a Strategy that parses a Number field- Parameters:
field
- The Calendar field
-
-
Method Details
-
isNumber
boolean isNumber()Is this field a number? The default implementation returns false.- Overrides:
isNumber
in classFastDateParser.Strategy
- Returns:
- true, if field is a number
-
addRegex
Generate aPattern
regular expression to theStringBuilder
which will accept this field- Specified by:
addRegex
in classFastDateParser.Strategy
- Parameters:
parser
- The parser calling this strategyregex
- TheStringBuilder
to append to- Returns:
- true, if this field will set the calendar; false, if this field is a constant value
-
setCalendar
Set the Calendar with the parsed field.The default implementation does nothing.
- Overrides:
setCalendar
in classFastDateParser.Strategy
- Parameters:
parser
- The parser calling this strategycal
- TheCalendar
to setvalue
- The parsed field to translate and set in cal
-
modify
int modify(int iValue) Make any modifications to parsed integer- Parameters:
iValue
- The parsed integer- Returns:
- The modified value
-