java.lang.Object
com.pervasive.datarush.encoding.text.TimeParser
- All Implemented Interfaces:
TokenParser
A parser producing time token values from a user-defined text format. By
default, parsed values must be both syntactically and semantically correct.
Lenient parsing is not allowed
-
Constructor Summary
ConstructorsConstructorDescriptionTimeParser(DateTimeFormatting format, String nullIndicator) Creates a parser using the specified format.TimeParser(String format) Creates a parser using the specified format. -
Method Summary
Modifier and TypeMethodDescriptionfinal StringWhenparsemethod returns false this method can be used to retrieve the specific error message detailing why the parsing failed.final booleanParses the given text string into a token value.protected final voidsetParseError(String msg) final voidsetTarget(ScalarSettable output) Sets the buffer for holding parsed values.
-
Constructor Details
-
TimeParser
Creates a parser using the specified format. Only empty strings are treated as null. Text values are interpreted strictly.- Parameters:
format- the input format to parse
-
TimeParser
Creates a parser using the specified format. Empty strings are treated as null. Text values are always interpreted strictly.- Parameters:
format- the input format to parsenullIndicator- the text value representing null values having the correct syntax, but not having a valid mapping.
-
-
Method Details
-
setTarget
Description copied from interface:TokenParserSets the buffer for holding parsed values. A reference to this container is held and accessed only when an formatting is requested.- Specified by:
setTargetin interfaceTokenParser- Parameters:
output- the value buffer in which to store parsed values
-
parse
Description copied from interface:TokenParserParses the given text string into a token value. If the parse succeeds, the result is stored in the target buffer. If it fails, the contents of the target buffer are unchanged and information regarding failure will be saved that is accessible by calling thegetParseErrormethod.- Specified by:
parsein interfaceTokenParser- Parameters:
text- text string to convert. Callers should not assume it is safe to passnull.- Returns:
trueif the parsing succeeded,falseotherwise.
-
setParseError
-
getParseError
Description copied from interface:TokenParserWhenparsemethod returns false this method can be used to retrieve the specific error message detailing why the parsing failed. If the last parse was successful an empty string will be returned- Specified by:
getParseErrorin interfaceTokenParser- Returns:
- a message detailing any parse errors that occurred
during the last call to
parse.
-