public class TypeInference extends Object
| Constructor and Description |
|---|
TypeInference() |
| Modifier and Type | Method and Description |
|---|---|
static BigInteger |
getBigInteger(String value)
Get big integer from a string.
|
static DataType |
getDataType(String value) |
static boolean |
isBoolean(String value)
Detect if the given value is a boolean type.
|
static boolean |
isDate(String value)
Detect if the given value is a date type.
|
static boolean |
isDouble(String value)
Detect if the given value is a double type.
|
static boolean |
isEmpty(String value)
Detect if the given value is blank or null.
|
static boolean |
isInteger(String value)
Detect if the given value is a integer type.
|
static boolean |
isNumber(String value) |
static boolean |
isTime(String value)
Detect if the given value is a time type.
|
static boolean |
isValid(DataType type,
String value) |
public static boolean isDouble(String value)
Note:
1. This method support only English locale.
e.g. TypeInference.isDouble("3.4") returns true.
e.g. TypeInference.isDouble("3,4") returns false.
2. Exponential notation can be detected as a valid double.
e.g. TypeInference.isDouble("1.0E+4") returns true.
e.g. TypeInference.isDouble("1.0e-4") returns true.
e.g. TypeInference.isDouble("1.0e-04") returns true.
3. Numbers marked with a type is invalid.
e.g. TypeInference.isDouble("3.4d") returns false.
e.g. TypeInference.isDouble("123L") returns false.
4. White space is invalid.
e.g. TypeInference.isDouble(" 3.4") returns false.
e.g. TypeInference.isDouble("3.4 ") returns false.
5. "." is not obligatory.
e.g. TypeInference.isDouble("100") returns true.
value - the value to be detected.public static boolean isInteger(String value)
value - the value to be detected.public static boolean isNumber(String value)
public static BigInteger getBigInteger(String value)
value - public static boolean isBoolean(String value)
value - the value to be detected.public static boolean isDate(String value)
value - the value to be detected.public static boolean isTime(String value)
value - public static boolean isEmpty(String value)
value - the value to be detected.public static boolean isValid(DataType type, String value)
type - the expected typevalue - the value to be detectedCopyright © 2024 CDAP Licensed under the Apache License, Version 2.0.