public abstract class RecordBuilderBase<T extends IndexedRecord> extends Object implements RecordBuilder<T>
Modifier | Constructor and Description |
---|---|
protected |
RecordBuilderBase(RecordBuilderBase<T> other,
GenericData data)
RecordBuilderBase copy constructor.
|
protected |
RecordBuilderBase(Schema schema,
GenericData data)
Creates a RecordBuilderBase for building records of the given type.
|
Modifier and Type | Method and Description |
---|---|
protected GenericData |
data() |
protected Object |
defaultValue(Schema.Field field)
Gets the default value of the given field, if any.
|
protected Object |
defaultValue(Schema.Field field,
Conversion<?> conversion)
Gets the default value of the given field, if any.
|
boolean |
equals(Object obj) |
protected Schema.Field[] |
fields() |
protected boolean[] |
fieldSetFlags() |
int |
hashCode() |
protected static boolean |
isValidValue(Schema.Field f,
Object value)
Tests whether a value is valid for a specified field.
|
protected Schema |
schema() |
protected void |
validate(Schema.Field field,
Object value)
Validates that a particular value for a given field is valid according to
the following algorithm:
1.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
build
protected RecordBuilderBase(Schema schema, GenericData data)
schema
- the schema associated with the record class.protected RecordBuilderBase(RecordBuilderBase<T> other, GenericData data)
other
- RecordBuilderBase instance to copy.protected final Schema schema()
protected final Schema.Field[] fields()
protected final boolean[] fieldSetFlags()
protected final GenericData data()
protected void validate(Schema.Field field, Object value)
field
- the field to validate.value
- the value to validate.NullPointerException
- if value is null and the given field does
not accept null values.protected static boolean isValidValue(Schema.Field f, Object value)
f
- the field for which to test the value.value
- the value to test.protected Object defaultValue(Schema.Field field) throws IOException
field
- the field whose default value should be retrieved.IOException
protected Object defaultValue(Schema.Field field, Conversion<?> conversion) throws IOException
field
- the field whose default value should be retrieved.conversion
- the tool to convert data to logical type classIOException
Copyright © 2009–2017 The Apache Software Foundation. All rights reserved.