Enum Class SpreadsheetDataType
- All Implemented Interfaces:
Serializable
,Comparable<SpreadsheetDataType>
,Constable
This ENUM enlists the various data types supported, namely String, Integer,
Double, Float and Boolean. This class provides convenience methods for
working with objects and data types.
- Author:
- Martins Francis
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
castColumnValue
(SpreadsheetDataType dataType, Object value) Ensures that the given value conforms to the given SpreadsheetDataType.static Object
coerceColumnValue
(SpreadsheetDataType dataType, Object value) static SpreadsheetDataType
Converts the given String representation of a data type to the corresponding internal representation.static String
formatAsString
(SpreadsheetDataType dataType) Returns a string representation of the given SpreadsheetDataType.static String
getDefaultDTValue
(SpreadsheetDataType dataType) Returns the default value of the given SpreadsheetDataType.static SpreadsheetDataType
Returns the enum constant of this class with the specified name.static SpreadsheetDataType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
STRING
-
INTEGER
-
BOOLEAN
-
DOUBLE
-
FLOAT
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
convert
Converts the given String representation of a data type to the corresponding internal representation. If it cannot be converted, then SpreadsheetConstants.DEFAULT_COL_DATATYPE is returned instead.- Parameters:
dataType
-- Returns:
- internal data type of the given String descriptor or SpreadsheetConstants.DEFAULT_COL_DATATYPE
-
castColumnValue
Ensures that the given value conforms to the given SpreadsheetDataType. If the value does not conform or cannot be converted then the default value of the given SpreadsheetDataType is returned.- Parameters:
dataType
-value
-- Returns:
- value converted to its data type
-
coerceColumnValue
-
getDefaultDTValue
Returns the default value of the given SpreadsheetDataType. If an unknown data type is given, then SpreadsheetConstants.DEFAULT_DT_VALUE is returned instead.- Parameters:
dataType
-- Returns:
- default value for the given data type
-
formatAsString
Returns a string representation of the given SpreadsheetDataType. If data type is unknown then null is returned.- Parameters:
dataType
-- Returns:
- String representation of the given data type
-