public interface RecordDef extends FieldDef
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.FieldDef.Type
Modifier and Type | Method and Description |
---|---|
RecordDef |
clone()
Perform a deep copy of this FieldDef instance.
|
boolean |
contains(String name)
Returns true if the record tyoe contains a field with the given name
|
FieldValue |
getDefaultValue(int pos)
Returns the default value for the field at the given position.
|
FieldValue |
getDefaultValue(String name)
Returns the default value for the named field.
|
FieldDef |
getField(int pos)
Deprecated.
as of 4.2 Use getFieldDef(int)
|
FieldDef |
getField(String name)
Deprecated.
as of 4.2 Use getFieldDef(String)
|
FieldDef |
getFieldDef(int pos)
Get the type of the field at the given position.
|
FieldDef |
getFieldDef(String name)
Get the type of the field with the given name.
|
String |
getFieldName(int pos)
Get the name of the field at the given position.
|
List<String> |
getFieldNames()
Get the names of the fields declared by this record type.
|
int |
getFieldPos(String fname)
Returns the position of the field with the given name
|
List<String> |
getFields()
Deprecated.
as of 4.2 Use getFieldNames()
|
String |
getName()
Get the name of the record type.
|
int |
getNumFields()
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.
|
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, isNumber, isNumeric, isRecord, isString, isTimestamp, isType, isValidIndexField, isValidKeyField
int getNumFields()
@Deprecated List<String> getFields()
List<String> getFieldNames()
boolean contains(String name)
@Deprecated FieldDef getField(String name)
name
- the name of the fieldFieldDef getFieldDef(String name)
name
- the name of the field@Deprecated FieldDef getField(int pos)
pos
- the index in the list of fields of the field to returnIndexOutOfBoundsException
- if the position is negative or
greater or equal to the number of fields declared by this record type.FieldDef getFieldDef(int pos)
pos
- the position of the field in the list of fieldsIndexOutOfBoundsException
- if the position is negative or
greater or equal to the number of fields declared by this record type.String getFieldName(int pos)
pos
- the position of the field in the list of fieldsIndexOutOfBoundsException
- if the position is negative or
greater or equal to the number of fields declared by this record type.int getFieldPos(String fname)
IllegalArgumentException
- if there is no field with the given nameString getName()
boolean isNullable(String name)
name
- the name of the fieldIllegalArgumentException
- if there is no field with the given nameboolean isNullable(int pos)
pos
- the position of the field in the list of fieldsIndexOutOfBoundsException
- if the position is negative or
greater or equal to the number of fields declared by this record type.FieldValue getDefaultValue(String name)
FieldValue
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 for isNullable(java.lang.String)
.name
- the name of the fieldIllegalArgumentException
- if there is no field with the given nameFieldValue getDefaultValue(int pos)
FieldValue
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 for isNullable(java.lang.String)
.pos
- the position of the field in the list of fieldsIndexOutOfBoundsException
- if the position is negative or
greater or equal to the number of fields declared by this record type.Copyright (c) 2011, 2017 Oracle and/or its affiliates. All rights reserved.