Enum Class SpreadsheetDataType

java.lang.Object
java.lang.Enum<SpreadsheetDataType>
org.eclipse.epsilon.emc.spreadsheets.SpreadsheetDataType
All Implemented Interfaces:
Serializable, Comparable<SpreadsheetDataType>, Constable

public enum SpreadsheetDataType extends Enum<SpreadsheetDataType>
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
  • Enum Constant Details

  • Method Details

    • values

      public static SpreadsheetDataType[] 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

      public static SpreadsheetDataType valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • convert

      public static SpreadsheetDataType convert(String dataType)
      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

      public static Object castColumnValue(SpreadsheetDataType dataType, Object value)
      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

      public static Object coerceColumnValue(SpreadsheetDataType dataType, Object value)
    • getDefaultDTValue

      public static String getDefaultDTValue(SpreadsheetDataType dataType)
      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

      public static String formatAsString(SpreadsheetDataType dataType)
      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