java.lang.Object
com.pervasive.datarush.schema.TypePattern
Describes a pattern which identifies a text data type.
Values which match the pattern can be assumed to be of
the associated data type.
TypePattern objects are used in conjunction
with PatternBasedDiscovery to discover schemas
for text files.
A number of patterns are pre-defined for common types.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TypePatternA pattern declaring a mapping toTextTypes.TRUE_FALSE.static final TypePatternA pattern declaring a mapping toTextTypes.ISO_DATE.static final TypePatternA pattern declaring a mapping toTextTypes.JAVA_DOUBLE.static final TypePatternA pattern declaring a mapping toTextTypes.JAVA_DURATION.static final TypePatternA pattern declaring a mapping toTextTypes.JAVA_INT.static final TypePatternA pattern declaring a mapping toTextTypes.TEXT_IPV4ADDRESS.static final TypePatternA pattern declaring a mapping toTextTypes.TEXT_IPV6ADDRESS.static final TypePatternA pattern declaring a mapping toTextTypes.JAVA_LONG.static final TypePatternA pattern declaring a mapping toTextTypes.JAVA_MONEYMatches vales containing an optional sign followed by an optional currency symbol, followed by up to 16 digits before an optional decimal point and up to 2 more digits.static final TypePatternA pattern declaring a mapping toTextTypes.JAVA_PERIOD.static final TypePatternA pattern declaring a mapping toTextTypes.ISO_TIMEOFDAY.static final TypePatternA pattern declaring a mapping toTextTypes.ISO_TIMESTAMP. -
Constructor Summary
ConstructorsConstructorDescriptionTypePattern(String pattern, TextDataType type) Declares the given pattern identifies values of the specified type. -
Method Summary
Modifier and TypeMethodDescriptionGets the pattern used for the mapping.getType()Gets the type implied by the mapping.booleanIndicates if the given value matches the pattern.
-
Field Details
-
INT_PATTERN
A pattern declaring a mapping toTextTypes.JAVA_INT. Matches values containing an optional sign and between 1 and 9 digits. -
LONG_PATTERN
A pattern declaring a mapping toTextTypes.JAVA_LONG. Matches values containing an optional sign and between 1 and 18 digits. -
MONEY_PATTERN
A pattern declaring a mapping toTextTypes.JAVA_MONEYMatches vales containing an optional sign followed by an optional currency symbol, followed by up to 16 digits before an optional decimal point and up to 2 more digits. Can also use optional US or EU style grouping notation. Also allows for accounting notation allowing parenthesis instead of a negative sign. -
DOUBLE_PATTERN
A pattern declaring a mapping toTextTypes.JAVA_DOUBLE. Matches values containing an optional sign and any number of digits with a decimal point ('.') embedded. Values may also have an optional exponent suffix ('E-2', for example). -
DATE_PATTERN
A pattern declaring a mapping toTextTypes.ISO_DATE. Matches values roughly conforming to the form of ISO-8601 dates.- The year may be any number of digits.
- The month and day must be 1 or 2 digits.
-
TIME_PATTERN
A pattern declaring a mapping toTextTypes.ISO_TIMEOFDAY. Matches values roughly conforming to the form of ISO-8601 times without zone offset.- The hour, minute, second must be 1 or 2 digits.
- A subsecond qualifier on the time may optionally be present.
-
TIMESTAMP_PATTERN
A pattern declaring a mapping toTextTypes.ISO_TIMESTAMP. Matches values roughly conforming to the form of ISO-8601 timestamps.- The year may be any number of digits.
- The month and day must be 1 or 2 digits.
- The date/time value is separated by either a 'T' or a space (' ').
- The hour, minute, second must be 1 or 2 digits.
- A subsecond qualifier on the time may optionally be present.
- A timezone identifier, either in the form 'Z' or explicit offset, may optionally be present.
-
BOOLEAN_PATTERN
A pattern declaring a mapping toTextTypes.TRUE_FALSE. Matches the values"true"and"false"case-insensitively. -
IP4ADDRESS_PATTERN
A pattern declaring a mapping toTextTypes.TEXT_IPV4ADDRESS. Matches values conforming to standard Ipv4 addresses in dotted form. -
IP6ADDRESS_PATTERN
A pattern declaring a mapping toTextTypes.TEXT_IPV6ADDRESS. Matches values conforming to standard Ipv6 addresses in IETF standard form. This includes compressed forms. Regular Expression from http://home.deds.nl/~aeron/regex/java.html -
DURATION_PATTERN
A pattern declaring a mapping toTextTypes.JAVA_DURATION. Matches values conforming to a Java Duration. -
PERIOD_PATTERN
A pattern declaring a mapping toTextTypes.JAVA_PERIOD. Matches values conforming to a Java Period.
-
-
Constructor Details
-
TypePattern
Declares the given pattern identifies values of the specified type. Patterns are specified as regular expressions which must match the entire value.- Parameters:
pattern- the regular expression to be matchedtype- the external data type implied by the pattern
-
-
Method Details
-
matches
Indicates if the given value matches the pattern.- Parameters:
value- the value to test- Returns:
trueif the value matches the pattern and should be considered to have the associated typefalseotherwise.
-
getPattern
Gets the pattern used for the mapping.- Returns:
- the regular expression used to test for matches
-
getType
Gets the type implied by the mapping.- Returns:
- the external data type matching values can be assumed to have
-