public class GenericRecordBuilder extends RecordBuilderBase<GenericData.Record>
Constructor and Description |
---|
GenericRecordBuilder(GenericData.Record other)
Creates a GenericRecordBuilder by copying an existing record instance.
|
GenericRecordBuilder(GenericRecordBuilder other)
Creates a GenericRecordBuilder by copying an existing GenericRecordBuilder.
|
GenericRecordBuilder(Schema schema)
Creates a GenericRecordBuilder for building Record instances.
|
Modifier and Type | Method and Description |
---|---|
GenericData.Record |
build()
Constructs a new instance using the values set in the RecordBuilder.
|
protected GenericRecordBuilder |
clear(int pos)
Clears the value of the given field.
|
GenericRecordBuilder |
clear(Schema.Field field)
Clears the value of the given field.
|
GenericRecordBuilder |
clear(String fieldName)
Clears the value of the given field.
|
boolean |
equals(Object obj) |
protected Object |
get(int pos)
Gets the value of a field.
|
Object |
get(Schema.Field field)
Gets the value of a field.
|
Object |
get(String fieldName)
Gets the value of a field.
|
protected boolean |
has(int pos)
Checks whether a field has been set.
|
boolean |
has(Schema.Field field)
Checks whether a field has been set.
|
boolean |
has(String fieldName)
Checks whether a field has been set.
|
int |
hashCode() |
protected GenericRecordBuilder |
set(int pos,
Object value)
Sets the value of a field.
|
GenericRecordBuilder |
set(Schema.Field field,
Object value)
Sets the value of a field.
|
GenericRecordBuilder |
set(String fieldName,
Object value)
Sets the value of a field.
|
data, defaultValue, fields, fieldSetFlags, isValidValue, schema, validate
public GenericRecordBuilder(Schema schema)
schema
- the schema associated with the record class.public GenericRecordBuilder(GenericRecordBuilder other)
other
- the GenericRecordBuilder to copy.public GenericRecordBuilder(GenericData.Record other)
other
- the record instance to copy.public Object get(String fieldName)
fieldName
- the name of the field to get.public Object get(Schema.Field field)
field
- the field to get.protected Object get(int pos)
pos
- the position of the field to get.public GenericRecordBuilder set(String fieldName, Object value)
fieldName
- the name of the field to set.value
- the value to set.public GenericRecordBuilder set(Schema.Field field, Object value)
field
- the field to set.value
- the value to set.protected GenericRecordBuilder set(int pos, Object value)
pos
- the field to set.value
- the value to set.public boolean has(String fieldName)
fieldName
- the name of the field to check.public boolean has(Schema.Field field)
field
- the field to check.protected boolean has(int pos)
pos
- the position of the field to check.public GenericRecordBuilder clear(String fieldName)
fieldName
- the name of the field to clear.public GenericRecordBuilder clear(Schema.Field field)
field
- the field to clear.protected GenericRecordBuilder clear(int pos)
pos
- the position of the field to clear.public GenericData.Record build()
RecordBuilder
public int hashCode()
hashCode
in class RecordBuilderBase<GenericData.Record>
public boolean equals(Object obj)
equals
in class RecordBuilderBase<GenericData.Record>
Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.