Package org.apache.avro
Class Schema.Field
java.lang.Object
org.apache.avro.JsonProperties
org.apache.avro.Schema.Field
- Enclosing class:
Schema
A field within a record.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
How values of this field should be ordered when sorting records.Nested classes/interfaces inherited from class org.apache.avro.JsonProperties
JsonProperties.Null
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Object
For Schema unions with a "null" type as the first entry, this can be used to specify that the default for the union is null.Fields inherited from class org.apache.avro.JsonProperties
NULL_VALUE
-
Constructor Summary
ConstructorDescriptionField
(Schema.Field field, Schema schema) Constructs a new Field instance with the samename
,doc
,defaultValue
, andorder
asfield
has with changing the schema to the specified one. -
Method Summary
Modifier and TypeMethodDescriptionvoid
aliases()
Return the defined aliases as an unmodifiable Set.doc()
Field's documentation within the record, if set.boolean
boolean
int
hashCode()
name()
order()
int
pos()
The position of this field within the record.schema()
This field'sSchema
.toString()
Methods inherited from class org.apache.avro.JsonProperties
addAllProps, addProp, addProp, forEachProperty, getObjectProp, getObjectProp, getObjectProps, getProp, hasProps, propsContainsKey, putAll
-
Field Details
-
NULL_DEFAULT_VALUE
For Schema unions with a "null" type as the first entry, this can be used to specify that the default for the union is null.
-
-
Constructor Details
-
Field
Constructs a new Field instance with the samename
,doc
,defaultValue
, andorder
asfield
has with changing the schema to the specified one. It also copies all theprops
andaliases
. -
Field
-
Field
-
Field
- Parameters:
defaultValue
- the default value for this field specified using the mapping inJsonProperties
-
Field
- Parameters:
defaultValue
- the default value for this field specified using the mapping inJsonProperties
-
-
Method Details
-
name
-
pos
public int pos()The position of this field within the record. -
schema
This field'sSchema
. -
doc
Field's documentation within the record, if set. May return null. -
hasDefaultValue
public boolean hasDefaultValue()- Returns:
- true if this Field has a default value set. Can be used to determine if a "null" return from defaultVal() is due to that being the default value or just not set.
-
defaultVal
- Returns:
- the default value for this field specified using the mapping in
JsonProperties
-
order
-
addAlias
-
aliases
Return the defined aliases as an unmodifiable Set. -
equals
-
hashCode
public int hashCode() -
toString
-