Package oracle.kv.table

# Interface FieldDef

All Known Subinterfaces:
  `AnyAtomicDef`, `AnyDef`, `AnyJsonAtomicDef`, `AnyRecordDef`, `ArrayDef`, `BinaryDef`, `BooleanDef`, `DoubleDef`, `EnumDef`, `FixedBinaryDef`, `FloatDef`, `IntegerDef`, `JsonDef`, `LongDef`, `MapDef`, `NumberDef`, `RecordDef`, `StringDef`, `TimestampDef`

public interface FieldDef
FieldDef represents an immutable metadata object used to represent a single data type. A data type defines a set of values, which are said to belong to or be instances of that data type. Data types are either atomic or complex. Atomic types define sets of atomic values, like integers, doubles, strings, etc. Complex types represent complex values, i.e., values that contain other (nested) values, like records, arrays, and maps.

All supported data types are represented as instances of FieldDef. Supported types are defined in the enumeration `Type`. Instances of FieldDef are created when defining the fields for a new `Table`, or during query processing.

Each instance has these properties:

- type -- the kind of the type (one of the values of the `FieldDef.Type` enum.
- description -- an optional description used when defining the type.

Since:
  3.0

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static enum`
  `FieldDef.Type`
  The type of a field definition.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AnyDef`
  `asAny()`
  Casts to AnyDef.
  `AnyAtomicDef`
  `asAnyAtomic()`
  Casts to AnyAtomicDef.
  `AnyJsonAtomicDef`
  `asAnyJsonAtomic()`
  Casts to AnyJsonAtomicDef.
  `AnyRecordDef`
  `asAnyRecord()`
  Casts to AnyRecordDef.
  `ArrayDef`
  `asArray()`
  Casts to ArrayDef.
  `BinaryDef`
  `asBinary()`
  Casts to BinaryDef.
  `BooleanDef`
  `asBoolean()`
  Casts to BooleanDef.
  `DoubleDef`
  `asDouble()`
  Casts to DoubleDef.
  `EnumDef`
  `asEnum()`
  Casts to EnumDef.
  `FixedBinaryDef`
  `asFixedBinary()`
  Casts to FixedBinaryDef.
  `FloatDef`
  `asFloat()`
  Casts to FloatDef.
  `IntegerDef`
  `asInteger()`
  Casts to IntegerDef.
  `JsonDef`
  `asJson()`
  Casts to JsonDef.
  `LongDef`
  `asLong()`
  Casts to LongDef.
  `MapDef`
  `asMap()`
  Casts to MapDef.
  `NumberDef`
  `asNumber()`
  Casts to NumberDef.
  `RecordDef`
  `asRecord()`
  Casts to RecordDef.
  `StringDef`
  `asString()`
  Casts to StringDef.
  `TimestampDef`
  `asTimestamp()`
  Casts to TimestampDef.
  `FieldDef`
  `clone()`
  Perform a deep copy of this FieldDef instance.
  `ArrayValue`
  `createArray()`
  Creates an empty ArrayValue.
  `BinaryValue`
  `createBinary(byte[] value)`
  Creates a BinaryValue instance based on the value.
  `BooleanValue`
  `createBoolean(boolean value)`
  Creates a BooleanValue instance based on the value.
  `DoubleValue`
  `createDouble(double value)`
  Creates a DoubleValue instance based on the value.
  `EnumValue`
  `createEnum(String value)`
  Creates an EnumValue instance based on the value.
  `FixedBinaryValue`
  `createFixedBinary(byte[] value)`
  Creates a FixedBinaryValue instance based on the value.
  `FloatValue`
  `createFloat(float value)`
  Creates a FloatValue instance based on the value.
  `IntegerValue`
  `createInteger(int value)`
  Creates an IntegerValue instance based on the value.
  `FieldValue`
  `createJsonNull()`
  Creates a special FieldValue instance representing a JSON null.
  `LongValue`
  `createLong(long value)`
  Creates a LongValue instance based on the value.
  `MapValue`
  `createMap()`
  Creates an empty MapValue.
  `NumberValue`
  `createNumber(double value)`
  Creates a NumberValue instance based on the value
  `NumberValue`
  `createNumber(float value)`
  Creates a NumberValue instance based on the value
  `NumberValue`
  `createNumber(int value)`
  Creates a NumberValue instance based on the value
  `NumberValue`
  `createNumber(long value)`
  Creates a NumberValue instance based on the value
  `NumberValue`
  `createNumber(BigDecimal value)`
  Creates a NumberValue instance based on the value
  `RecordValue`
  `createRecord()`
  Creates an empty RecordValue.
  `StringValue`
  `createString(String value)`
  Creates a StringValue instance based on the value.
  `TimestampValue`
  `createTimestamp(Timestamp value)`
  Creates a TimestampValue instance based on the value.
  `String`
  `getDescription()`
  Returns the description of the field.
  `FieldDef.Type`
  `getType()`
  Returns the type of the field.
  `boolean`
  `isAny()`
  Returns true if this is an `AnyDef`.
  `boolean`
  `isAnyAtomic()`
  Returns true if this is an `AnyAtomicDef`.
  `boolean`
  `isAnyJsonAtomic()`
  Returns true if this is an `AnyJsonAtomicDef`.
  `boolean`
  `isAnyRecord()`
  Returns true if this is an `AnyRecordDef`.
  `boolean`
  `isArray()`
  Returns true if this is an `ArrayDef`.
  `boolean`
  `isAtomic()`
  Returns true if this is an atomic type.
  `boolean`
  `isBinary()`
  Returns true if this is a `BinaryDef`.
  `boolean`
  `isBoolean()`
  Returns true if this is a `BooleanDef`.
  `boolean`
  `isComplex()`
  Returns true if this is a complex type.
  `boolean`
  `isDouble()`
  Returns true if this is a `DoubleDef`.
  `boolean`
  `isEnum()`
  Returns true if this is an `EnumDef`.
  `boolean`
  `isFixedBinary()`
  Returns true if this is a `FixedBinaryDef`.
  `boolean`
  `isFloat()`
  Returns true if this is a `FloatDef`.
  `boolean`
  `isInteger()`
  Returns true if this is an `IntegerDef`.
  `boolean`
  `isJson()`
  Returns true if this is a JSON type.
  `boolean`
  `isLong()`
  Returns true if this is a `LongDef`.
  `boolean`
  `isMap()`
  Returns true if this is a `MapDef`.
  `default boolean`
  `isMRCounter()`
  Returns true if this is a multi-region counter.
  `boolean`
  `isNumber()`
  Returns true if this is a `NumberDef`.
  `boolean`
  `isNumeric()`
  Returns true if this is a numeric type.
  `boolean`
  `isPrecise()`
  `boolean`
  `isRecord()`
  Returns true if this is a `RecordDef`.
  `boolean`
  `isString()`
  Returns true if this is a `StringDef`.
  `boolean`
  `isTimestamp()`
  Returns true if this is a `TimestampDef`.
  `boolean`
  `isType(FieldDef.Type type)`
  Returns true if the type of this field matches the parameter.
  `boolean`
  `isUUIDString()`
  Returns true if this is a STRING AS UUID type
  `boolean`
  `isValidIndexField()`
  `boolean`
  `isValidKeyField()`

- ## Method Details

  - ### clone

    FieldDef clone()
    Perform a deep copy of this FieldDef instance.
    Returns:
      a new instance equal to this

  - ### getDescription

    String getDescription()
    Returns the description of the field.
    Returns:
      the description of the field if set, otherwise null

  - ### getType

    FieldDef.Type getType()
    Returns the type of the field.
    Returns:
      the type of the field

  - ### isType

    boolean isType(FieldDef.Type type)
    Returns true if the type of this field matches the parameter.
    Returns:
      true if the type of this field matches the parameter

  - ### isValidKeyField

    boolean isValidKeyField()
    Returns:
      true if this type can participate in a primary key. Only atomic types can be part of a key. Among the atomic types, Boolean, Binary and FixedBinary are not allowed in keys.

  - ### isValidIndexField

    boolean isValidIndexField()
    Returns:
      true if this type can participate in an index. Only atomic types can be part of an index key. Among the atomic types, Boolean, Binary and FixedBinary are not allowed in index keys.

  - ### isAny

    boolean isAny()
    Returns true if this is an `AnyDef`.
    Returns:
      true if this is an AnyDef, false otherwise
    Since:
      4.0

  - ### isAnyRecord

    boolean isAnyRecord()
    Returns true if this is an `AnyRecordDef`.
    Returns:
      true if this is an AnyRecordDef, false otherwise
    Since:
      4.0

  - ### isAnyAtomic

    boolean isAnyAtomic()
    Returns true if this is an `AnyAtomicDef`.
    Returns:
      true if this is an AnyAtomicDef, false otherwise
    Since:
      4.0

  - ### isNumber

    boolean isNumber()
    Returns true if this is a `NumberDef`.
    Returns:
      true if this is a NumberDef, false otherwise
    Since:
      4.4

  - ### isAnyJsonAtomic

    boolean isAnyJsonAtomic()
    Returns true if this is an `AnyJsonAtomicDef`.
    Returns:
      true if this is an AnyJsonAtomicDef, false otherwise
    Since:
      4.3

  - ### isBoolean

    boolean isBoolean()
    Returns true if this is a `BooleanDef`.
    Returns:
      true if this is a BooleanDef, false otherwise

  - ### isBinary

    boolean isBinary()
    Returns true if this is a `BinaryDef`.
    Returns:
      true if this is a BinaryDef, false otherwise

  - ### isDouble

    boolean isDouble()
    Returns true if this is a `DoubleDef`.
    Returns:
      true if this is a DoubleDef, false otherwise

  - ### isEnum

    boolean isEnum()
    Returns true if this is an `EnumDef`.
    Returns:
      true if this is an EnumDef, false otherwise

  - ### isFixedBinary

    boolean isFixedBinary()
    Returns true if this is a `FixedBinaryDef`.
    Returns:
      true if this is a FixedBinaryDef, false otherwise

  - ### isFloat

    boolean isFloat()
    Returns true if this is a `FloatDef`.
    Returns:
      true if this is a FloatDef, false otherwise

  - ### isInteger

    boolean isInteger()
    Returns true if this is an `IntegerDef`.
    Returns:
      true if this is an IntegerDef, false otherwise

  - ### isLong

    boolean isLong()
    Returns true if this is a `LongDef`.
    Returns:
      true if this is a LongDef, false otherwise

  - ### isString

    boolean isString()
    Returns true if this is a `StringDef`.
    Returns:
      true if this is a StringDef, false otherwise

  - ### isUUIDString

    boolean isUUIDString()
    Returns true if this is a STRING AS UUID type
    Returns:
      true if this is a STRING AS UUID type, false otherwise

  - ### isTimestamp

    boolean isTimestamp()
    Returns true if this is a `TimestampDef`.
    Returns:
      true if this is a TimestampDef, false otherwise
    Since:
      4.3

  - ### isArray

    boolean isArray()
    Returns true if this is an `ArrayDef`.
    Returns:
      true if this is an ArrayDef, false otherwise

  - ### isMap

    boolean isMap()
    Returns true if this is a `MapDef`.
    Returns:
      true if this is a MapDef, false otherwise

  - ### isRecord

    boolean isRecord()
    Returns true if this is a `RecordDef`.
    Returns:
      true if this is a RecordDef, false otherwise

  - ### isJson

    boolean isJson()
    Returns true if this is a JSON type.
    Returns:
      true if this is a JSON type, false otherwise
    Since:
      4.2

  - ### isAtomic

    boolean isAtomic()
    Returns true if this is an atomic type.
    Returns:
      true if this is an atomic type, false otherwise
    Since:
      4.0

  - ### isNumeric

    boolean isNumeric()
    Returns true if this is a numeric type.
    Returns:
      true if this is a numeric type, false otherwise
    Since:
      4.0

  - ### isComplex

    boolean isComplex()
    Returns true if this is a complex type.
    Returns:
      true if this is a complex type, false otherwise
    Since:
      4.0

  - ### isPrecise

    boolean isPrecise()
    Since:
      20.1

  - ### isMRCounter

    default boolean isMRCounter()
    Returns true if this is a multi-region counter.
    Returns:
      true if this is a multi-region counter, false otherwise.
    Since:
      21.1

  - ### asAny

    AnyDef asAny()
    Casts to AnyDef.
    Returns:
      an AnyDef
    Throws:
      `ClassCastException` - if this is not an AnyDef
    Since:
      4.0

  - ### asAnyRecord

    AnyRecordDef asAnyRecord()
    Casts to AnyRecordDef.
    Returns:
      an AnyRecordDef
    Throws:
      `ClassCastException` - if this is not an AnyRecordDef
    Since:
      4.0

  - ### asAnyAtomic

    AnyAtomicDef asAnyAtomic()
    Casts to AnyAtomicDef.
    Returns:
      an AnyAtomicDef
    Throws:
      `ClassCastException` - if this is not an AnyAtomicDef
    Since:
      4.0

  - ### asAnyJsonAtomic

    AnyJsonAtomicDef asAnyJsonAtomic()
    Casts to AnyJsonAtomicDef.
    Returns:
      an AnyJsonAtomicDef
    Throws:
      `ClassCastException` - if this is not an AnyJsonAtomicDef
    Since:
      4.3

  - ### asBinary

    BinaryDef asBinary()
    Casts to BinaryDef.
    Returns:
      a BinaryDef
    Throws:
      `ClassCastException` - if this is not a BinaryDef

  - ### asNumber

    NumberDef asNumber()
    Casts to NumberDef.
    Returns:
      a NumberDef
    Throws:
      `ClassCastException` - if this is not a NumberDef
    Since:
      4.4

  - ### asBoolean

    BooleanDef asBoolean()
    Casts to BooleanDef.
    Returns:
      a BooleanDef
    Throws:
      `ClassCastException` - if this is not a BooleanDef

  - ### asDouble

    DoubleDef asDouble()
    Casts to DoubleDef.
    Returns:
      a DoubleDef
    Throws:
      `ClassCastException` - if this is not a DoubleDef

  - ### asEnum

    EnumDef asEnum()
    Casts to EnumDef.
    Returns:
      an EnumDef
    Throws:
      `ClassCastException` - if this is not an EnumDef

  - ### asFixedBinary

    FixedBinaryDef asFixedBinary()
    Casts to FixedBinaryDef.
    Returns:
      a FixedBinaryDef
    Throws:
      `ClassCastException` - if this is not a FixedBinaryDef

  - ### asFloat

    FloatDef asFloat()
    Casts to FloatDef.
    Returns:
      a FloatDef
    Throws:
      `ClassCastException` - if this is not a FloatDef

  - ### asInteger

    IntegerDef asInteger()
    Casts to IntegerDef.
    Returns:
      an IntegerDef
    Throws:
      `ClassCastException` - if this is not an IntegerDef

  - ### asLong

    LongDef asLong()
    Casts to LongDef.
    Returns:
      a LongDef
    Throws:
      `ClassCastException` - if this is not a LongDef

  - ### asString

    StringDef asString()
    Casts to StringDef.
    Returns:
      a StringDef
    Throws:
      `ClassCastException` - if this is not a StringDef

  - ### asTimestamp

    TimestampDef asTimestamp()
    Casts to TimestampDef.
    Returns:
      a TimestampDef
    Throws:
      `ClassCastException` - if this is not a TimestampDef
    Since:
      4.3

  - ### asArray

    ArrayDef asArray()
    Casts to ArrayDef.
    Returns:
      an ArrayDef
    Throws:
      `ClassCastException` - if this is not an ArrayDef

  - ### asMap

    MapDef asMap()
    Casts to MapDef.
    Returns:
      a MapDef
    Throws:
      `ClassCastException` - if this is not a MapDef

  - ### asRecord

    RecordDef asRecord()
    Casts to RecordDef.
    Returns:
      a RecordDef
    Throws:
      `ClassCastException` - if this is not a RecordDef

  - ### asJson

    JsonDef asJson()
    Casts to JsonDef.
    Returns:
      a JsonDef
    Throws:
      `ClassCastException` - if this is not a JsonDef
    Since:
      4.2

  - ### createArray

    ArrayValue createArray()
    Creates an empty ArrayValue.
    Returns:
      an empty ArrayValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create an ArrayValue

  - ### createNumber

    NumberValue createNumber(int value)
    Creates a NumberValue instance based on the value
    Parameters:
      `value` - the value to use
    Returns:
      a NumberValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a NumberValue
    Since:
      4.4

  - ### createNumber

    NumberValue createNumber(long value)
    Creates a NumberValue instance based on the value
    Parameters:
      `value` - the value to use
    Returns:
      a NumberValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a NumberValue
    Since:
      4.4

  - ### createNumber

    NumberValue createNumber(float value)
    Creates a NumberValue instance based on the value
    Parameters:
      `value` - the value to use
    Returns:
      a NumberValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a NumberValue
    Since:
      4.4

  - ### createNumber

    NumberValue createNumber(double value)
    Creates a NumberValue instance based on the value
    Parameters:
      `value` - the value to use
    Returns:
      a NumberValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a NumberValue
    Since:
      4.4

  - ### createNumber

    NumberValue createNumber(BigDecimal value)
    Creates a NumberValue instance based on the value
    Parameters:
      `value` - a non-null BigDecimal value
    Returns:
      a NumberValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a NumberValue
    Since:
      4.4

  - ### createBinary

    BinaryValue createBinary(byte[] value)
    Creates a BinaryValue instance based on the value.
    Parameters:
      `value` - the byte array to use for the new value object. Must not be null.
    Returns:
      a BinaryValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a BinaryValue or if the value is null

  - ### createBoolean

    BooleanValue createBoolean(boolean value)
    Creates a BooleanValue instance based on the value.
    Parameters:
      `value` - the value to use
    Returns:
      a BooleanValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a BooleanValue

  - ### createDouble

    DoubleValue createDouble(double value)
    Creates a DoubleValue instance based on the value.
    Parameters:
      `value` - the value to use
    Returns:
      a DoubleValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a DoubleValue

  - ### createEnum

    EnumValue createEnum(String value)
    Creates an EnumValue instance based on the value.
    Parameters:
      `value` - the value to use
    Returns:
      a EnumValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create an EnumValue or if the value is not valid for the definition

  - ### createFixedBinary

    FixedBinaryValue createFixedBinary(byte[] value)
    Creates a FixedBinaryValue instance based on the value.
    Parameters:
      `value` - the value to use. It must not be null.
    Returns:
      a FixedBinaryValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a FixedBinaryValue or if the value is null or not valid for the definition

  - ### createFloat

    FloatValue createFloat(float value)
    Creates a FloatValue instance based on the value.
    Parameters:
      `value` - the value to use
    Returns:
      a FloatValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a FloatValue

  - ### createInteger

    IntegerValue createInteger(int value)
    Creates an IntegerValue instance based on the value.
    Parameters:
      `value` - the value to use
    Returns:
      a IntegerValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create an IntegerValue or if the value is not valid for the definition

  - ### createLong

    LongValue createLong(long value)
    Creates a LongValue instance based on the value.
    Parameters:
      `value` - the value to use
    Returns:
      a LongValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a LongValue

  - ### createTimestamp

    TimestampValue createTimestamp(Timestamp value)
    Creates a TimestampValue instance based on the value.
    Parameters:
      `value` - the value to use
    Returns:
      a TimestampValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a TimestampValue
    Since:
      4.3

  - ### createMap

    MapValue createMap()
    Creates an empty MapValue.
    Returns:
      an empty MapValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a MapValue

  - ### createRecord

    RecordValue createRecord()
    Creates an empty RecordValue.
    Returns:
      an empty RecordValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a RecordValue

  - ### createString

    StringValue createString(String value)
    Creates a StringValue instance based on the value.
    Parameters:
      `value` - the value to use
    Returns:
      a StringValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a StringValue

  - ### createJsonNull

    FieldValue createJsonNull()
    Creates a special FieldValue instance representing a JSON null. This value returns true for `FieldValue.isJsonNull()`.
    Returns:
      a FieldValue
    Throws:
      `IllegalArgumentException` - if this instance is not able to create a JSON null (is not of type JSON)
    Since:
      4.3