Package oracle.kv.table
Interface RecordDef
- All Superinterfaces:
FieldDef
RecordDef represents a record type, which specifies a set of
RecordValue
s that conform to this type. The type definition declares
a number of fields, where a field consists of a name and an associated type.
The field types need not be the same. The declaration order of the fields is
important. Based on this order, each field has a unique position, which is
a number between 0 and N - 1, where N is the number of fields. In addition
to its name, type, and position, each field may be declared nullable or
non-nullable (with the default being nullable), and may have an associated
default value. The default value is required for non-nullable fields;
otherwise, the default default-value is the NULL value (an instance of
FieldValue for which the isNull() method returns true).
A RecordValue
conforms to a record type if (a) it has the same number
of fields as the type, (b) the fields in the record value and the record type
have the same names and appear in the same order, and (c) the field values in
the record have the same type as the type of the corresponding fields in the
record type.- Since:
- 3.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface oracle.kv.table.FieldDef
FieldDef.Type
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Perform a deep copy of this FieldDef instance.boolean
Returns true if the record tyoe contains a field with the given namegetDefaultValue
(int pos) Returns the default value for the field at the given position.getDefaultValue
(String name) Returns the default value for the named field.getField
(int pos) Deprecated.as of 4.2 Use getFieldDef(int)Deprecated.as of 4.2 Use getFieldDef(String)getFieldDef
(int pos) Get the type of the field at the given position.getFieldDef
(String name) Get the type of the field with the given name.getFieldName
(int pos) Get the name of the field at the given position.Get the names of the fields declared by this record type.int
getFieldPos
(String fname) Returns the position of the field with the given nameDeprecated.as of 4.2 Use getFieldNames()getName()
Get the name of the record type.int
Get the number of fields declared by this record type.boolean
isNullable
(int pos) Returns true if the field at the given position is nullable.boolean
isNullable
(String name) Returns true if the named field is nullable.Methods inherited from interface oracle.kv.table.FieldDef
asAny, asAnyAtomic, asAnyJsonAtomic, asAnyRecord, asArray, asBinary, asBoolean, asDouble, asEnum, asFixedBinary, asFloat, asInteger, asJson, asLong, asMap, asNumber, asRecord, asString, asTimestamp, createArray, createBinary, createBoolean, createDouble, createEnum, createFixedBinary, createFloat, createInteger, createJsonNull, createLong, createMap, createNumber, createNumber, createNumber, createNumber, createNumber, createRecord, createString, createTimestamp, getDescription, getType, isAny, isAnyAtomic, isAnyJsonAtomic, isAnyRecord, isArray, isAtomic, isBinary, isBoolean, isComplex, isDouble, isEnum, isFixedBinary, isFloat, isInteger, isJson, isLong, isMap, isMRCounter, isNumber, isNumeric, isPrecise, isRecord, isString, isTimestamp, isType, isUUIDString, isValidIndexField, isValidKeyField
-
Method Details
-
getNumFields
int getNumFields()Get the number of fields declared by this record type.- Returns:
- the number of fields declared by this record type
- Since:
- 4.2
-
getFields
Deprecated.as of 4.2 Use getFieldNames()Get the names of the fields declared by this record type. The names are returned in declaration order.- Returns:
- an unmodifiable list of the field names in declaration order
-
getFieldNames
Get the names of the fields declared by this record type. The names are returned in declaration order.- Returns:
- an unmodifiable list of the field names in declaration order
- Since:
- 4.2
-
contains
Returns true if the record tyoe contains a field with the given name- Returns:
- true if the record tyoe contains a field with the given name, false otherwise
-
getField
Deprecated.as of 4.2 Use getFieldDef(String)Get the type of the field with the given name.- Parameters:
name
- the name of the field- Returns:
- the type of the field with the given name, or null if there is no field with such a name
-
getFieldDef
Get the type of the field with the given name.- Parameters:
name
- the name of the field- Returns:
- the type of the field with the given name, or null if there is no field with such a name
- Since:
- 4.2
-
getField
Deprecated.as of 4.2 Use getFieldDef(int)Get the type of the field at the given position.- Parameters:
pos
- the index in the list of fields of the field to return- Returns:
- the type of the field at the specified position.
- Throws:
IndexOutOfBoundsException
- if the position is negative or greater or equal to the number of fields declared by this record type.- Since:
- 4.0
-
getFieldDef
Get the type of the field at the given position.- Parameters:
pos
- the position of the field in the list of fields- Returns:
- the type of the field at the specified position.
- Throws:
IndexOutOfBoundsException
- if the position is negative or greater or equal to the number of fields declared by this record type.- Since:
- 4.2
-
getFieldName
Get the name of the field at the given position.- Parameters:
pos
- the position of the field in the list of fields- Returns:
- the name of the field at the given position.
- Throws:
IndexOutOfBoundsException
- if the position is negative or greater or equal to the number of fields declared by this record type.- Since:
- 4.0
-
getFieldPos
Returns the position of the field with the given name- Returns:
- the position of the field with the given name.
- Throws:
IllegalArgumentException
- if there is no field with the given name- Since:
- 4.2
-
getName
String getName()Get the name of the record type. Record types require names even if they are nested or used as an array or map element.- Returns:
- the name of the record type
-
isNullable
Returns true if the named field is nullable.- Parameters:
name
- the name of the field- Returns:
- true if the named field is nullable
- Throws:
IllegalArgumentException
- if there is no field with the given name
-
isNullable
boolean isNullable(int pos) Returns true if the field at the given position is nullable.- Parameters:
pos
- the position of the field in the list of fields- Returns:
- true if the named field is nullable
- Throws:
IndexOutOfBoundsException
- if the position is negative or greater or equal to the number of fields declared by this record type.- Since:
- 4.2
-
getDefaultValue
Returns the default value for the named field. The return value isFieldValue
and not a more specific type because in the case of nullable fields the default will be a null value, which is a special value that returns true forisNullable(java.lang.String)
.- Parameters:
name
- the name of the field- Returns:
- a default value
- Throws:
IllegalArgumentException
- if there is no field with the given name
-
getDefaultValue
Returns the default value for the field at the given position. The return value isFieldValue
and not a more specific type because in the case of nullable fields the default will be a null value, which is a special value that returns true forisNullable(java.lang.String)
.- Parameters:
pos
- the position of the field in the list of fields- Returns:
- a default value
- Throws:
IndexOutOfBoundsException
- if the position is negative or greater or equal to the number of fields declared by this record type.- Since:
- 4.2
-
clone
RecordDef clone()Description copied from interface:FieldDef
Perform a deep copy of this FieldDef instance.
-