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
Nested ClassesModifier and TypeClassDescriptionstatic enumHow values of this field should be ordered when sorting records.Nested classes/interfaces inherited from class org.apache.avro.JsonProperties
JsonProperties.Null -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ObjectFor 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
ConstructorsConstructorDescriptionField(Schema.Field field, Schema schema) Constructs a new Field instance with the samename,doc,defaultValue, andorderasfieldhas with changing the schema to the specified one. -
Method Summary
Modifier and TypeMethodDescriptionvoidaliases()Return the defined aliases as an unmodifiable Set.doc()Field's documentation within the record, if set.booleanbooleaninthashCode()name()order()intpos()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, andorderasfieldhas with changing the schema to the specified one. It also copies all thepropsandaliases. -
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
-