public class TypePattern extends Object
TypePattern objects are used in conjunction
with PatternBasedDiscovery to discover schemas
for text files.
A number of patterns are pre-defined for common types.
| Modifier and Type | Field and Description |
|---|---|
static TypePattern |
BOOLEAN_PATTERN
A pattern declaring a mapping to
TextTypes.TRUE_FALSE. |
static TypePattern |
DATE_PATTERN
A pattern declaring a mapping to
TextTypes.ISO_DATE. |
static TypePattern |
DOUBLE_PATTERN
A pattern declaring a mapping to
TextTypes.JAVA_DOUBLE. |
static TypePattern |
INT_PATTERN
A pattern declaring a mapping to
TextTypes.JAVA_INT. |
static TypePattern |
LONG_PATTERN
A pattern declaring a mapping to
TextTypes.JAVA_LONG. |
static TypePattern |
TIME_PATTERN
A pattern declaring a mapping to
TextTypes.ISO_TIMEOFDAY. |
static TypePattern |
TIMESTAMP_PATTERN
A pattern declaring a mapping to
TextTypes.ISO_TIMESTAMP. |
| Constructor and Description |
|---|
TypePattern(String pattern,
TextDataType type)
Declares the given pattern identifies values of the specified type.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getPattern()
Gets the pattern used for the mapping.
|
TextDataType |
getType()
Gets the type implied by the mapping.
|
boolean |
matches(String value)
Indicates if the given value matches the pattern.
|
public static final TypePattern INT_PATTERN
TextTypes.JAVA_INT.
Matches values containing an optional sign and between 1 and 9 digits.public static final TypePattern LONG_PATTERN
TextTypes.JAVA_LONG.
Matches values containing an optional sign and between 1 and 18 digits.public static final TypePattern DOUBLE_PATTERN
TextTypes.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).public static final TypePattern DATE_PATTERN
TextTypes.ISO_DATE.
Matches values roughly conforming to the form of ISO-8601 dates.
public static final TypePattern TIME_PATTERN
TextTypes.ISO_TIMEOFDAY.
Matches values roughly conforming to the form of ISO-8601 times without zone offset.
public static final TypePattern TIMESTAMP_PATTERN
TextTypes.ISO_TIMESTAMP.
Matches values roughly conforming to the form of ISO-8601 timestamps.
public static final TypePattern BOOLEAN_PATTERN
TextTypes.TRUE_FALSE.
Matches the values "true" and "false" case-insensitively.public TypePattern(String pattern, TextDataType type)
pattern - the regular expression to be matchedtype - the external data type implied by the patternpublic boolean matches(String value)
value - the value to testtrue if the value matches the pattern
and should be considered to have the associated type
false otherwise.public String getPattern()
public TextDataType getType()
Copyright © 2016 Actian Corporation. All rights reserved.