Enum Class DataType

java.lang.Object
java.lang.Enum<DataType>
com.streambase.sb.DataType
All Implemented Interfaces:
Serializable, Comparable<DataType>, Constable

public enum DataType extends Enum<DataType>
An enumeration that represents the types that StreamBase supports.
  • Enum Constant Details

    • INT

      public static final DataType INT
      Integer type, four bytes.
    • LONG

      public static final DataType LONG
      Long type, eight bytes.
    • DOUBLE

      public static final DataType DOUBLE
      Double type, eight bytes.
    • STRING

      public static final DataType STRING
      String type of user-defined length.
    • BLOB

      public static final DataType BLOB
      Blob type of undefined length.
    • TIMESTAMP

      public static final DataType TIMESTAMP
      Timestamp type, eight byte storage.
    • BOOL

      public static final DataType BOOL
      Boolean type, four bytes.
    • LIST

      public static final DataType LIST
      List type, variable length
    • TUPLE

      public static final DataType TUPLE
      sub-schema, variable length
    • CAPTURE

      public static final DataType CAPTURE
      Capture type; opaque, variable length
    • FUNCTION

      public static final DataType FUNCTION
      Function type: variable length, arguments: Schema, return: CompleteDataType
  • Field Details

    • SIMPLE_TYPES

      public static final DataType[] SIMPLE_TYPES
      The types that have no parameterization, just values.
    • VARIABLE_SIZE

      public static final int VARIABLE_SIZE
      Indicator for a variable size data type
      See Also:
  • Method Details

    • values

      public static DataType[] 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 DataType 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
    • isLexicallyComparable

      public boolean isLexicallyComparable()
      Returns true if we guarantee lexical comparisons between values of this type work.
      Returns:
      if lexical comparison works
    • getSize

      public int getSize()
      Get the size in bytes of this DataType.
      Returns:
      the size in bytes of this DataType (VARIABLE_SIZE indicates variable size)
    • getName

      public String getName()
      Get the name of this DataType.
      Returns:
      the name of this DataType
    • forType

      public static final DataType forType(Class<?> clazz)
      Return the appropriate DataType for the given clazz. Will return null if can't determine the appropriate class.
      Parameters:
      clazz - an object to determine the class of
      Returns:
      appropriate DataType or null if none
    • typeNameFor

      public static final String typeNameFor(Class<?> clazz)
      Return the type name for the given Class type. If there is no mapping return the original class name
      Parameters:
      clazz - an object to determine the class of
      Returns:
      appropriate DataType name or class name
    • forType

      public static DataType forType(Object obj)
      Return the appropriate DataType for the given type. Will return null if can't determine the appropriate type.
      Parameters:
      obj - an object to determine the type of
      Returns:
      appropriate DataType or null if none
    • isVariableSize

      public boolean isVariableSize()
      Return whether this DataType is of variable size or not
      Returns:
      true if and only if this DataType is of variable size, false otherwise.
    • toString

      public String toString()
      Return the name of the DataType.
      Overrides:
      toString in class Enum<DataType>
      Returns:
      the name of the DataType
    • allTypes

      @Deprecated public static final Collection<DataType> allTypes()
      Deprecated.
      use DataType.values()
      Return a read-only Collection of all the types that StreamBase supports.
      Returns:
      a collection of all the types that StreamBase Supports.
    • forName

      public static DataType forName(String typeName)
      For the given name return a DataType Object. Returns null if the name is not a valid DataType
      Parameters:
      typeName - DataType name to lookup
      Returns:
      DataType found, or null