Enum DataType

  • All Implemented Interfaces:
    Serializable, Comparable<DataType>

    public enum DataType
    extends Enum<DataType>
    implements Serializable
    An enumeration that represents the types that StreamBase supports.

    Note: Serializations of instances of this class that are created (e.g., by using ObjectOutputStream) in one version of StreamBase in general will not be deserializable in any other version of StreamBase.

    • Enum Constant Detail

      • 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 Detail

      • SIMPLE_TYPES

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

      • values

        public static DataType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (DataType c : DataType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static DataType valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type 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 (currently only for STRING and BLOB).
        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

        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