FieldType (Apache Geode 1.15.4)

org.apache.geode.pdx

## Enum FieldType

- java.lang.Object
- - java.lang.Enum<FieldType>
  - - org.apache.geode.pdx.FieldType

- All Implemented Interfaces:
    Serializable, Comparable<FieldType>

      public enum FieldType
      extends Enum<FieldType>

  Every field of a pdx must have one of these types. The type of that field can never change. If you do want to be able to change a field's class then its field type needs to be `OBJECT`. Some field types are always serialized with a certain number of bytes; these are called "fixed-width". Others are serialized with a variable number of bytes; these are called "variable-width".
  Since:
    GemFire 6.6.2

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `ARRAY_OF_BYTE_ARRAYS`
    `BOOLEAN`
    `BOOLEAN_ARRAY`
    `BYTE`
    `BYTE_ARRAY`
    `CHAR`
    `CHAR_ARRAY`
    `DATE`
    `DOUBLE`
    `DOUBLE_ARRAY`
    `FLOAT`
    `FLOAT_ARRAY`
    `INT`
    `INT_ARRAY`
    `LONG`
    `LONG_ARRAY`
    `OBJECT`
    `OBJECT_ARRAY`
    `SHORT`
    `SHORT_ARRAY`
    `STRING`
    `STRING_ARRAY`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static FieldType` | `get(Class<?> c)` Given a Class return the corresponding FieldType.
    `ByteBuffer` | `getDefaultBytes()`
    `Object` | `getDefaultValue()`
    `int` | `getWidth()`
    `boolean` | `isFixedWidth()`
    `String` | `toString()`
    `static FieldType` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static FieldType[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### BOOLEAN

          public static final FieldType BOOLEAN

    - #### BYTE

          public static final FieldType BYTE

    - #### CHAR

          public static final FieldType CHAR

    - #### SHORT

          public static final FieldType SHORT

    - #### INT

          public static final FieldType INT

    - #### LONG

          public static final FieldType LONG

    - #### FLOAT

          public static final FieldType FLOAT

    - #### DOUBLE

          public static final FieldType DOUBLE

    - #### DATE

          public static final FieldType DATE

    - #### STRING

          public static final FieldType STRING

    - #### OBJECT

          public static final FieldType OBJECT

    - #### BOOLEAN_ARRAY

          public static final FieldType BOOLEAN_ARRAY

    - #### CHAR_ARRAY

          public static final FieldType CHAR_ARRAY

    - #### BYTE_ARRAY

          public static final FieldType BYTE_ARRAY

    - #### SHORT_ARRAY

          public static final FieldType SHORT_ARRAY

    - #### INT_ARRAY

          public static final FieldType INT_ARRAY

    - #### LONG_ARRAY

          public static final FieldType LONG_ARRAY

    - #### FLOAT_ARRAY

          public static final FieldType FLOAT_ARRAY

    - #### DOUBLE_ARRAY

          public static final FieldType DOUBLE_ARRAY

    - #### STRING_ARRAY

          public static final FieldType STRING_ARRAY

    - #### OBJECT_ARRAY

          public static final FieldType OBJECT_ARRAY

    - #### ARRAY_OF_BYTE_ARRAYS

          public static final FieldType ARRAY_OF_BYTE_ARRAYS

  - ### Method Detail

    - #### values

          public static FieldType[] 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 (FieldType c : FieldType.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static FieldType 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

    - #### isFixedWidth

          public boolean isFixedWidth()

      Returns:
        true if the type is "fixed-width"; false if it is "variable-width".

    - #### getWidth

          public int getWidth()

      Returns:
        the number of bytes used to serialize fixed-width fields; -1 is returned for variable-width fields.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Enum<FieldType>`

    - #### getDefaultBytes

          public ByteBuffer getDefaultBytes()

      Returns:
        a ByteBuffer that contains the serialized encoding of this type's default value.

    - #### get

          public static FieldType get(Class<?> c)

      Given a Class return the corresponding FieldType.
      Parameters:
        `c` - a `Class`
      Returns:
        the `FieldType` corresponding to the given `Class`

    - #### getDefaultValue

          public Object getDefaultValue()