Class AvroWriteContext
java.lang.Object
tools.jackson.core.TokenStreamContext
tools.jackson.dataformat.avro.ser.AvroWriteContext
- Direct Known Subclasses:
ArrayWriteContext,MapWriteContext,NopWriteContext,ObjectWriteContext
public abstract class AvroWriteContext
extends tools.jackson.core.TokenStreamContext
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Objectprotected final AvroGeneratorprotected final AvroWriteContextprotected final org.apache.avro.SchemaFields inherited from class tools.jackson.core.TokenStreamContext
_index, _nestingDepth, _type, TYPE_ARRAY, TYPE_OBJECT, TYPE_ROOT -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAvroWriteContext(int type, AvroWriteContext parent, AvroGenerator generator, org.apache.avro.Schema schema, Object currValue) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.avro.generic.GenericArray<Object>_createArray(org.apache.avro.Schema schema) protected AvroWriteContext_createObjectContext(org.apache.avro.Schema schema, Object currValue) protected org.apache.avro.generic.GenericRecord_createRecord(org.apache.avro.Schema schema) protected org.apache.avro.generic.GenericRecord_createRecord(org.apache.avro.Schema schema, Object currValue) protected org.apache.avro.Schema_recordOrMapFromUnion(org.apache.avro.Schema unionSchema) protected abstract voidvoidbooleancanClose()voidcomplete()abstract AvroWriteContextcreateChildArrayContext(Object currValue) abstract AvroWriteContextcreateChildObjectContext(Object currValue) static AvroWriteContextcreateRootContext(AvroGenerator generator, org.apache.avro.Schema schema, org.apache.avro.io.BinaryEncoder encoder) final AvroWriteContextstatic AvroWriteContextFactory method called to get a placeholder context that is only in place until actual schema is handed.abstract ObjectrawValue()Accessor called to link data being built with resulting object.static intresolveUnionIndex(org.apache.avro.Schema unionSchema, Object datum) Resolves the sub-schema from a union that should correspond to thedatum.static org.apache.avro.SchemaresolveUnionSchema(org.apache.avro.Schema unionSchema, Object datum) Resolves the sub-schema from a union that should correspond to thedatum.static org.apache.avro.SchemaresolveUnionType(org.apache.avro.Schema unionSchema, Object datum) final StringtoString()Overridden to provide developer writeable "JsonPath" representation of the context.voidwriteBinary(byte[] data, int offset, int len) booleanMethod that writer is to call before it writes an Object property name.abstract voidabstract voidwriteString(String value) abstract voidwriteValue(Object value) Methods inherited from class tools.jackson.core.TokenStreamContext
getCurrentIndex, getEntryCount, getNestingDepth, hasCurrentIndex, hasCurrentName, hasPathSegment, inArray, inObject, inRoot, pathAsPointer, pathAsPointer, startLocation, typeDesc
-
Field Details
-
_parent
-
_generator
-
_schema
protected final org.apache.avro.Schema _schema -
_currentValue
-
-
Constructor Details
-
AvroWriteContext
protected AvroWriteContext(int type, AvroWriteContext parent, AvroGenerator generator, org.apache.avro.Schema schema, Object currValue)
-
-
Method Details
-
createRootContext
public static AvroWriteContext createRootContext(AvroGenerator generator, org.apache.avro.Schema schema, org.apache.avro.io.BinaryEncoder encoder) -
nullContext
Factory method called to get a placeholder context that is only in place until actual schema is handed. -
createChildArrayContext
-
createChildObjectContext
-
complete
- Throws:
IOException
-
currentValue
- Overrides:
currentValuein classtools.jackson.core.TokenStreamContext
-
assignCurrentValue
- Overrides:
assignCurrentValuein classtools.jackson.core.TokenStreamContext
-
getParent
- Specified by:
getParentin classtools.jackson.core.TokenStreamContext
-
currentName
- Specified by:
currentNamein classtools.jackson.core.TokenStreamContext
-
writeName
Method that writer is to call before it writes an Object property name.- Returns:
- True if writing succeeded (for
ObjectWriteContext, iff column was recognized) - Throws:
IOException
-
writeValue
- Throws:
IOException
-
writeBinary
- Throws:
IOException
-
writeString
- Throws:
IOException
-
writeNull
- Throws:
IOException
-
rawValue
Accessor called to link data being built with resulting object. -
canClose
public boolean canClose() -
appendDesc
-
toString
Overridden to provide developer writeable "JsonPath" representation of the context.- Overrides:
toStringin classtools.jackson.core.TokenStreamContext
-
_createRecord
protected org.apache.avro.generic.GenericRecord _createRecord(org.apache.avro.Schema schema, Object currValue) -
_createRecord
protected org.apache.avro.generic.GenericRecord _createRecord(org.apache.avro.Schema schema) -
_createArray
-
_createObjectContext
-
_recordOrMapFromUnion
protected org.apache.avro.Schema _recordOrMapFromUnion(org.apache.avro.Schema unionSchema) -
resolveUnionIndex
Resolves the sub-schema from a union that should correspond to thedatum.- Parameters:
unionSchema- Union of schemas from which to choosedatum- Object that needs to map to one of the schemas inunionSchema- Returns:
- Index into
unionSchema.getTypes()that matchesdatum - Throws:
org.apache.avro.UnresolvedUnionException- ifunionSchemadoes not have a schema that can encodedatum- See Also:
-
resolveUnionType
public static org.apache.avro.Schema resolveUnionType(org.apache.avro.Schema unionSchema, Object datum) -
resolveUnionSchema
public static org.apache.avro.Schema resolveUnionSchema(org.apache.avro.Schema unionSchema, Object datum) Resolves the sub-schema from a union that should correspond to thedatum.- Parameters:
unionSchema- Union of schemas from which to choosedatum- Object that needs to map to one of the schemas inunionSchema- Returns:
- Schema that matches
datum - Throws:
org.apache.avro.UnresolvedUnionException- ifunionSchemadoes not have a schema that can encodedatum- See Also:
-