Top Inners Fields Constructors Methods
tools.jackson.dataformat.avro.ser

public abstract Class AvroWriteContext

extends TokenStreamContext
Class Inheritance
Known Direct Subclasses
tools.jackson.dataformat.avro.ser.AvroWriteContext.NullContext, tools.jackson.dataformat.avro.ser.KeyValueContext, tools.jackson.dataformat.avro.ser.NopWriteContext, tools.jackson.dataformat.avro.ser.RootContext, tools.jackson.dataformat.avro.ser.ArrayWriteContext
Imports
java.io.IOException, java.math.BigDecimal, java.util.*, org.apache.avro.Schema, .Schema.Type, .UnresolvedUnionException, org.apache.avro.generic.*, org.apache.avro.io.BinaryEncoder, org.apache.avro.reflect.ReflectData, tools.jackson.core.JsonGenerator, .TokenStreamContext, tools.jackson.databind.DatabindException, tools.jackson.dataformat.avro.AvroGenerator, tools.jackson.dataformat.avro.schema.AvroSchemaHelper

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
AvroWriteContext.NullContext

Virtual context implementation used when there is no real root context available.

Field Summary

Modifier and TypeField and Description
protected Object
protected final AvroGenerator
protected final AvroWriteContext
protected final Schema
private static final Class<?>
private static final Class<?>
private static final Class<?>
private static final Class<?>
Inherited from tools.jackson.core.TokenStreamContext:
_index_nestingDepth_typeTYPE_ARRAYTYPE_OBJECTTYPE_ROOT

Constructor Summary

AccessConstructor and Description
protected
AvroWriteContext(int type, AvroWriteContext parent, AvroGenerator generator, Schema schema, Object currValue)

Method Summary

Modifier and TypeMethod and Description
protected GenericArray<Object>
protected AvroWriteContext
_createObjectContext(Schema schema, Object currValue)

protected GenericRecord
_createRecord(Schema schema, Object currValue)

protected GenericRecord
private static Schema
private static int
protected Schema
private static int
_resolveArrayIndex(Schema unionSchema, List<Schema> types, GenericData.Array<?> value)

private static int
_resolveBigDecimalIndex(Schema unionSchema, List<Schema> types, BigDecimal value)

private static int
_resolveMapIndex(Schema unionSchema, List<Schema> types, Object value)

private static int
private static int
_resolveStringIndex(Schema unionSchema, List<Schema> types, String value)

protected abstract void
public void
assignCurrentValue(Object v)

Overrides tools.jackson.core.TokenStreamContext.assignCurrentValue.

Method to call to pass value to be returned via currentValue; typically called indirectly through JsonParser#assignCurrentValue or JsonGenerator#assignCurrentValue).

public boolean
public void
public abstract AvroWriteContext
public abstract AvroWriteContext
public static AvroWriteContext
public String
currentName()

Implements abstract tools.jackson.core.TokenStreamContext.currentName.

Method for accessing name associated with the current location.

public Object
currentValue()

Overrides tools.jackson.core.TokenStreamContext.currentValue.

Method for accessing currently active value being used by data-binding (as the source of streaming data to write, or destination of data being read), at this level in hierarchy.

public final AvroWriteContext
getParent()

Implements abstract tools.jackson.core.TokenStreamContext.getParent.

Accessor for finding parent context of this context; will return null for root context.

public static AvroWriteContext
nullContext()

Factory method called to get a placeholder context that is only in place until actual schema is handed.

public abstract Object
rawValue()

Accessor called to link data being built with resulting object.

public static int

Returns:

Index into unionSchema.getTypes() that matches datum
resolveUnionIndex
(Schema
Union of schemas from which to choose
unionSchema
,
Object
Object that needs to map to one of the schemas in unionSchema
datum
)

Resolves the sub-schema from a union that should correspond to the datum.

public static Schema

Returns:

Schema that matches datum
resolveUnionSchema
(Schema
Union of schemas from which to choose
unionSchema
,
Object
Object that needs to map to one of the schemas in unionSchema
datum
)

Resolves the sub-schema from a union that should correspond to the datum.

public static Schema
resolveUnionType(Schema unionSchema, Object datum)

public final String
toString()

Overrides tools.jackson.core.TokenStreamContext.toString.

Overridden to provide developer writeable "JsonPath" representation of the context.

public void
writeBinary(byte[] data, int offset, int len)

public boolean

Returns:

True if writing succeeded (for ObjectWriteContext, iff column was recognized)
writeName
(String name)

Method that writer is to call before it writes an Object property name.

public abstract void
public abstract void
public abstract void
Inherited from tools.jackson.core.TokenStreamContext:
getCurrentIndexgetEntryCountgetNestingDepthhasCurrentIndexhasCurrentNamehasPathSegmentinArrayinObjectinRootpathAsPointerpathAsPointerstartLocationtypeDesc

Field Detail

_currentValueback to summary
protected Object _currentValue
_generatorback to summary
protected final AvroGenerator _generator
_parentback to summary
protected final AvroWriteContext _parent
_schemaback to summary
protected final Schema _schema
CLS_BIG_DECIMALback to summary
private static final Class<?> CLS_BIG_DECIMAL
CLS_GENERIC_ARRAYback to summary
private static final Class<?> CLS_GENERIC_ARRAY
CLS_GENERIC_RECORDback to summary
private static final Class<?> CLS_GENERIC_RECORD
CLS_STRINGback to summary
private static final Class<?> CLS_STRING

Constructor Detail

AvroWriteContextback to summary
protected AvroWriteContext(int type, AvroWriteContext parent, AvroGenerator generator, Schema schema, Object currValue)

Method Detail

_createArrayback to summary
protected GenericArray<Object> _createArray(Schema schema)
_createObjectContextback to summary
protected AvroWriteContext _createObjectContext(Schema schema, Object currValue)
_createRecordback to summary
protected GenericRecord _createRecord(Schema schema, Object currValue)
_createRecordback to summary
protected GenericRecord _createRecord(Schema schema)
_findNotNullback to summary
private static Schema _findNotNull(List<Schema> types)
_findNotNullIndexback to summary
private static int _findNotNullIndex(List<Schema> types)
_recordOrMapFromUnionback to summary
protected Schema _recordOrMapFromUnion(Schema unionSchema)
_resolveArrayIndexback to summary
private static int _resolveArrayIndex(Schema unionSchema, List<Schema> types, GenericData.Array<?> value)
_resolveBigDecimalIndexback to summary
private static int _resolveBigDecimalIndex(Schema unionSchema, List<Schema> types, BigDecimal value)
_resolveMapIndexback to summary
private static int _resolveMapIndex(Schema unionSchema, List<Schema> types, Object value)
_resolveRecordIndexback to summary
private static int _resolveRecordIndex(Schema unionSchema, List<Schema> types, GenericData.Record value)
_resolveStringIndexback to summary
private static int _resolveStringIndex(Schema unionSchema, List<Schema> types, String value)
appendDescback to summary
protected abstract void appendDesc(StringBuilder sb)
assignCurrentValueback to summary
public void assignCurrentValue(Object v)

Overrides tools.jackson.core.TokenStreamContext.assignCurrentValue.

Doc from tools.jackson.core.TokenStreamContext.assignCurrentValue.

Method to call to pass value to be returned via currentValue; typically called indirectly through JsonParser#assignCurrentValue or JsonGenerator#assignCurrentValue).

Annotations
@Override
canCloseback to summary
public boolean canClose()
completeback to summary
public void complete() throws IOException
createChildArrayContextback to summary
public abstract AvroWriteContext createChildArrayContext(Object currValue)
createChildObjectContextback to summary
public abstract AvroWriteContext createChildObjectContext(Object currValue)
createRootContextback to summary
public static AvroWriteContext createRootContext(AvroGenerator generator, Schema schema, BinaryEncoder encoder)
currentNameback to summary
public String currentName()

Implements abstract tools.jackson.core.TokenStreamContext.currentName.

Doc from tools.jackson.core.TokenStreamContext.currentName.

Method for accessing name associated with the current location. Non-null for PROPERTY_NAME and value events that directly follow Property names; null for root level and array values.

Annotations
@Override
currentValueback to summary
public Object currentValue()

Overrides tools.jackson.core.TokenStreamContext.currentValue.

Doc from tools.jackson.core.TokenStreamContext.currentValue.

Method for accessing currently active value being used by data-binding (as the source of streaming data to write, or destination of data being read), at this level in hierarchy.

Note that "current value" is NOT populated (or used) by Streaming parser or generator; it is only used by higher-level data-binding functionality. The reason it is included here is that it can be stored and accessed hierarchically, and gets passed through data-binding.

Annotations
@Override
getParentback to summary
public final AvroWriteContext getParent()

Implements abstract tools.jackson.core.TokenStreamContext.getParent.

Doc from tools.jackson.core.TokenStreamContext.getParent.

Accessor for finding parent context of this context; will return null for root context.

Annotations
@Override
nullContextback to summary
public static AvroWriteContext nullContext()

Factory method called to get a placeholder context that is only in place until actual schema is handed.

rawValueback to summary
public abstract Object rawValue()

Accessor called to link data being built with resulting object.

resolveUnionIndexback to summary
public static int resolveUnionIndex(Schema unionSchema, Object datum)

Resolves the sub-schema from a union that should correspond to the datum.

Parameters
unionSchema:Schema

Union of schemas from which to choose

datum:Object

Object that needs to map to one of the schemas in unionSchema

Returns:int

Index into unionSchema.getTypes() that matches datum

Exceptions
UnresolvedUnionException:
if unionSchema does not have a schema that can encode datum
See Also
resolveUnionSchema(Schema, Object)
resolveUnionSchemaback to summary
public static Schema resolveUnionSchema(Schema unionSchema, Object datum)

Resolves the sub-schema from a union that should correspond to the datum.

Parameters
unionSchema:Schema

Union of schemas from which to choose

datum:Object

Object that needs to map to one of the schemas in unionSchema

Returns:Schema

Schema that matches datum

Exceptions
UnresolvedUnionException:
if unionSchema does not have a schema that can encode datum
See Also
resolveUnionIndex(Schema, Object)
resolveUnionTypeback to summary
public static Schema resolveUnionType(Schema unionSchema, Object datum)
toStringback to summary
public final String toString()

Overrides tools.jackson.core.TokenStreamContext.toString.

Overridden to provide developer writeable "JsonPath" representation of the context.

Annotations
@Override
writeBinaryback to summary
public void writeBinary(byte[] data, int offset, int len) throws IOException
writeNameback to summary
public boolean writeName(String name) throws IOException

Method that writer is to call before it writes an Object property name.

Returns:boolean

True if writing succeeded (for ObjectWriteContext, iff column was recognized)

writeNullback to summary
public abstract void writeNull() throws IOException
writeStringback to summary
public abstract void writeString(String value) throws IOException
writeValueback to summary
public abstract void writeValue(Object value) throws IOException
tools.jackson.dataformat.avro.ser back to summary

private final Class AvroWriteContext.NullContext

extends AvroWriteContext
Class Inheritance

Virtual context implementation used when there is no real root context available.

Field Summary

Modifier and TypeField and Description
public static final AvroWriteContext.NullContext
Inherited from tools.jackson.dataformat.avro.ser.AvroWriteContext:
_currentValue_generator_parent_schema

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected void
public void
public final AvroWriteContext
public final AvroWriteContext
public Object
rawValue()

Implements abstract tools.jackson.dataformat.avro.ser.AvroWriteContext.rawValue.

Accessor called to link data being built with resulting object.

public void
public void
public void
Inherited from tools.jackson.dataformat.avro.ser.AvroWriteContext:
_createArray_createObjectContext_createRecord_createRecord_recordOrMapFromUnionassignCurrentValuecanClosecompletecreateRootContextcurrentNamecurrentValuegetParentnullContextresolveUnionIndexresolveUnionSchemaresolveUnionTypetoStringwriteBinarywriteName

Field Detail

instanceback to summary
public static final AvroWriteContext.NullContext instance

Constructor Detail

NullContextback to summary
private NullContext()

Method Detail

_reportErrorback to summary
protected void _reportError()
appendDescback to summary
public void appendDesc(StringBuilder sb)

Implements abstract tools.jackson.dataformat.avro.ser.AvroWriteContext.appendDesc.

Annotations
@Override
createChildArrayContextback to summary
public final AvroWriteContext createChildArrayContext(Object currValue)

Implements abstract tools.jackson.dataformat.avro.ser.AvroWriteContext.createChildArrayContext.

Annotations
@Override
createChildObjectContextback to summary
public final AvroWriteContext createChildObjectContext(Object currValue)

Implements abstract tools.jackson.dataformat.avro.ser.AvroWriteContext.createChildObjectContext.

Annotations
@Override
rawValueback to summary
public Object rawValue()

Implements abstract tools.jackson.dataformat.avro.ser.AvroWriteContext.rawValue.

Doc from tools.jackson.dataformat.avro.ser.AvroWriteContext.rawValue.

Accessor called to link data being built with resulting object.

Annotations
@Override
writeNullback to summary
public void writeNull()

Implements abstract tools.jackson.dataformat.avro.ser.AvroWriteContext.writeNull.

Annotations
@Override
writeStringback to summary
public void writeString(String value)

Implements abstract tools.jackson.dataformat.avro.ser.AvroWriteContext.writeString.

Annotations
@Override
writeValueback to summary
public void writeValue(Object value)

Implements abstract tools.jackson.dataformat.avro.ser.AvroWriteContext.writeValue.

Annotations
@Override