Enum DataType

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<DataType>

    public enum DataType
    extends java.lang.Enum<DataType>
    Enum defining the data primitives that can be serialised. Arrays are always handled as multi-dimensional arrays.
    Author:
    rstein
    • Enum Constant Detail

      • BOOL

        public static final DataType BOOL
      • BYTE

        public static final DataType BYTE
      • SHORT

        public static final DataType SHORT
      • LONG

        public static final DataType LONG
      • FLOAT

        public static final DataType FLOAT
      • DOUBLE

        public static final DataType DOUBLE
      • STRING

        public static final DataType STRING
      • BOOL_ARRAY

        public static final DataType BOOL_ARRAY
      • BYTE_ARRAY

        public static final DataType BYTE_ARRAY
      • SHORT_ARRAY

        public static final DataType SHORT_ARRAY
      • INT_ARRAY

        public static final DataType INT_ARRAY
      • LONG_ARRAY

        public static final DataType LONG_ARRAY
      • FLOAT_ARRAY

        public static final DataType FLOAT_ARRAY
      • DOUBLE_ARRAY

        public static final DataType DOUBLE_ARRAY
      • STRING_ARRAY

        public static final DataType STRING_ARRAY
      • END_MARKER

        public static final DataType END_MARKER
    • 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​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getAsByte

        public byte getAsByte()
        Returns the byte representation of the data type.
        Returns:
        the byte representation
      • getPrimitiveSize

        public long getPrimitiveSize()
      • getClassType

        public java.lang.Class<?> getClassType()
        Returns the corresponding java class type matching the given data type
        Returns:
        the matching java class type
      • isScalar

        public boolean isScalar()
      • getAsString

        public java.lang.String getAsString()
        Returns the string representation of the data type.
        Returns:
        the string representation
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Enum<DataType>
      • fromString

        public static DataType fromString​(java.lang.String str)
        Returns the data type matching the given string representation, if any.
        Parameters:
        str - the string to be searched
        Returns:
        the matching data type
      • fromByte

        public static DataType fromByte​(byte value)
        Returns the data type matching the given byte representation, if any.
        Parameters:
        value - the value to be searched
        Returns:
        the matching data type
      • fromClassType

        public static DataType fromClassType​(java.lang.Class<?> classType)
        Returns the data type matching the given java class type, if any.
        Parameters:
        classType - the value to be searched
        Returns:
        the matching data type