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

public Class AvroMapper

extends ObjectMapper
Class Inheritance
Imports
java.io.File, .IOException, .InputStream, org.apache.avro.Schema, tools.jackson.core.JacksonException, .JsonGenerator, .Version, tools.jackson.databind.*, tools.jackson.databind.cfg.MapperBuilder, .MapperBuilderState, tools.jackson.databind.exc.InvalidDefinitionException, tools.jackson.databind.util.ClassUtil, tools.jackson.dataformat.avro.schema.AvroSchemaGenerator

Convenience AvroMapper, which is mostly similar to simply constructing a mapper with AvroFactory, but also adds little bit of convenience around AvroSchema generation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
AvroMapper.Builder

Base implementation for "Vanilla" ObjectMapper, used with Avro backend.

private static class
AvroMapper.SharedWrapper

Helper class to contain dynamically constructed "shared" instance of mapper, should one be needed via shared.

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from tools.jackson.databind.ObjectMapper:
_deserializationConfig_deserializationContexts_injectableValues_rootDeserializers_savedBuilderState_serializationConfig_serializationContexts_streamFactory_typeFactory

Constructor Summary

AccessConstructor and Description
public
AvroMapper()

Constructor that will construct mapper with standard AvroFactory as codec, and will also register AvroModule.

public
AvroMapper(AvroFactory f)

Constructor that will construct mapper with given AvroFactory, as well as register standard AvroModule (with default settings).

public

Method Summary

Modifier and TypeMethod and Description
protected JacksonException
public static AvroMapper.Builder
public static AvroMapper.Builder
builder(AvroFactory streamFactory)

public AvroMapper.Builder
rebuild()

Overrides tools.jackson.databind.ObjectMapper.rebuild.

Method for creating a new MapperBuilder for constructing differently configured ObjectMapper instance, starting with current configuration including base settings and registered modules.

public AvroSchema
schemaFor(Class<?> type)

Factory method for constructing AvroSchema by introspecting given POJO type and building schema that contains specified properties.

public AvroSchema
schemaFor(JavaType type)

Factory method for constructing AvroSchema by introspecting given POJO type and building schema that contains specified properties.

public AvroSchema
schemaFrom(InputStream in)

Method for reading an Avro Schema from given InputStream, and once done (successfully or not), closing the stream.

public AvroSchema
schemaFrom(String schemaAsString)

Convenience method for reading AvroSchema from given encoded JSON representation.

public AvroSchema
schemaFrom(File schemaFile)

Convenience method for reading AvroSchema from given encoded JSON representation.

public static AvroMapper
shared()

Accessor method for getting globally shared "default" AvroMapper instance: one that has default configuration, no modules registered, no config overrides.

public AvroFactory
tokenStreamFactory()

Overrides tools.jackson.databind.ObjectMapper.tokenStreamFactory.

Method that can be used to get hold of TokenStreamFactory that this mapper uses if it needs to construct JsonParsers and/or JsonGenerators.

public Version
version()

Overrides tools.jackson.databind.ObjectMapper.version.

Implements tools.jackson.core.Versioned.version.

Method that will return version information stored in and read from jar that contains this class.

Inherited from tools.jackson.databind.ObjectMapper:
_assertNotNull_configAndWriteValue_convert_deserializationContext_deserializationContext_deserializationContext_findRootDeserializer_initForReading_newReader_newReader_newWriter_newWriter_newWriter_readMapAndClose_readTreeAndClose_readValue_serializationContext_serializationContext_verifyNoTrailingTokens_verifySchemaType_writeCloseableValueacceptJsonFormatVisitoracceptJsonFormatVisitoracceptJsonFormatVisitorbooleanNodeclearCachesconstructTypeconstructTypeconvertValueconvertValueconvertValuecreateArrayNodecreateGeneratorcreateGeneratorcreateGeneratorcreateGeneratorcreateGeneratorcreateGeneratorcreateNonBlockingByteArrayParsercreateNonBlockingByteBufferParsercreateObjectNodecreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParserdeserializationConfiggetInjectableValuesgetNodeFactorygetTypeFactoryisEnabledisEnabledisEnabledisEnabledisEnabledisEnabledisEnabledmissingNodenullNodereaderreaderreaderreaderreaderreaderreaderreaderreaderreaderForreaderForreaderForreaderForArrayOfreaderForListOfreaderForMapOfreaderForUpdatingreaderWithViewreadResolvereadTreereadTreereadTreereadTreereadTreereadTreereadTreereadTreereadTreereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuesreadValuesreadValuesregisteredModulesserializationConfigstringNodetreeAsTokenstreeToValuetreeToValuetreeToValueupdateValuevalueToTreewriterwriterwriterwriterwriterwriterwriterwriterwriterwriterwriteReplacewriterForwriterForwriterForwriterWithDefaultPrettyPrinterwriterWithViewwriteTreewriteValuewriteValuewriteValuewriteValuewriteValuewriteValuewriteValueAsByteswriteValueAsStringwriteValueIntoBuffer

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.databind.ObjectMapper.serialVersionUID.

Constructor Detail

AvroMapperback to summary
public AvroMapper()

Constructor that will construct mapper with standard AvroFactory as codec, and will also register AvroModule.

AvroMapperback to summary
public AvroMapper(AvroFactory f)

Constructor that will construct mapper with given AvroFactory, as well as register standard AvroModule (with default settings).

AvroMapperback to summary
public AvroMapper(AvroMapper.Builder b)

Method Detail

_invalidSchemaDefinitionback to summary
protected JacksonException _invalidSchemaDefinition(JavaType type, Exception e0)
builderback to summary
public static AvroMapper.Builder builder()
builderback to summary
public static AvroMapper.Builder builder(AvroFactory streamFactory)
rebuildback to summary
public AvroMapper.Builder rebuild()

Overrides tools.jackson.databind.ObjectMapper.rebuild.

Doc from tools.jackson.databind.ObjectMapper.rebuild.

Method for creating a new MapperBuilder for constructing differently configured ObjectMapper instance, starting with current configuration including base settings and registered modules.

Annotations
@SuppressWarnings:unchecked
@Override
schemaForback to summary
public AvroSchema schemaFor(Class<?> type)

Factory method for constructing AvroSchema by introspecting given POJO type and building schema that contains specified properties.

Resulting schema object does not use separate reader/writer schemas.

schemaForback to summary
public AvroSchema schemaFor(JavaType type)

Factory method for constructing AvroSchema by introspecting given POJO type and building schema that contains specified properties.

Resulting schema object does not use separate reader/writer schemas.

schemaFromback to summary
public AvroSchema schemaFrom(InputStream in) throws IOException

Method for reading an Avro Schema from given InputStream, and once done (successfully or not), closing the stream.

Resulting schema object does not use separate reader/writer schemas.

schemaFromback to summary
public AvroSchema schemaFrom(String schemaAsString) throws IOException

Convenience method for reading AvroSchema from given encoded JSON representation.

Resulting schema object does not use separate reader/writer schemas.

schemaFromback to summary
public AvroSchema schemaFrom(File schemaFile) throws IOException

Convenience method for reading AvroSchema from given encoded JSON representation.

Resulting schema object does not use separate reader/writer schemas.

sharedback to summary
public static AvroMapper shared()

Accessor method for getting globally shared "default" AvroMapper instance: one that has default configuration, no modules registered, no config overrides. Usable mostly when dealing "untyped" or Tree-style content reading and writing.

tokenStreamFactoryback to summary
public AvroFactory tokenStreamFactory()

Overrides tools.jackson.databind.ObjectMapper.tokenStreamFactory.

Doc from tools.jackson.databind.ObjectMapper.tokenStreamFactory.

Method that can be used to get hold of TokenStreamFactory that this mapper uses if it needs to construct JsonParsers and/or JsonGenerators.

Warning

note that all ObjectReader and ObjectWriter instances created by this mapper usually share the same configured TokenStreamFactory, so changes to its configuration will "leak". To avoid such observed changes you should always use "with()" and "without()" method of ObjectReader and ObjectWriter for changing StreamReadFeature and StreamWriteFeature settings to use on per-call basis.

Annotations
@Override
versionback to summary
public Version version()

Overrides tools.jackson.databind.ObjectMapper.version.

Implements tools.jackson.core.Versioned.version.

Doc from tools.jackson.databind.ObjectMapper.version.

Method that will return version information stored in and read from jar that contains this class.

Annotations
@Override
tools.jackson.dataformat.avro back to summary

public Class AvroMapper.Builder

extends MapperBuilder<AvroMapper, AvroMapper.Builder>
Class Inheritance

Base implementation for "Vanilla" ObjectMapper, used with Avro backend.
Since
3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class

Field Summary

Inherited from tools.jackson.databind.cfg.MapperBuilder:
_abstractTypeResolvers_baseSettings_classIntrospector_coercionConfigs_configOverrides_datatypeFeatures_defaultAttributes_defaultPrettyPrinter_deserFeatures_deserializationContexts_deserializerFactory_filterProvider_formatReadFeatures_formatWriteFeatures_injectableValues_mapperFeatures_mixInHandler_modules_problemHandlers_savedState_serFeatures_serializationContexts_serializerFactory_streamFactory_streamReadFeatures_streamWriteFeatures_subtypeResolver_typeFactory_typeResolverProviderDEFAULT_ACCESSOR_NAMINGDEFAULT_ANNOTATION_INTROSPECTORDEFAULT_BASE_SETTINGSDEFAULT_DESER_FEATURESDEFAULT_MAPPER_FEATURESDEFAULT_PRETTY_PRINTERDEFAULT_SER_FEATURESDEFAULT_TYPE_RESOLVER_PROVIDERDEFAULT_TYPE_VALIDATORNO_ABSTRACT_TYPE_RESOLVERS

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
protected MapperBuilderState
public AvroMapper
build()

Implements abstract tools.jackson.databind.cfg.MapperBuilder.build.

Method to call to create actual mapper instance.

public AvroMapper.Builder
configure(AvroReadFeature feature, boolean state)

public AvroMapper.Builder
configure(AvroWriteFeature feature, boolean state)

public AvroMapper.Builder
disable(AvroReadFeature... features)

public AvroMapper.Builder
public AvroMapper.Builder
enable(AvroReadFeature... features)

public AvroMapper.Builder
enable(AvroWriteFeature... features)

Inherited from tools.jackson.databind.cfg.MapperBuilder:
_constructModuleContext_defaultClassIntrospector_defaultDefaultAttributes_defaultDefaultTypingResolver_defaultDefaultTypingResolver_defaultDeserializationContexts_defaultMixInHandler_defaultPrettyPrinter_defaultSerializationContexts_defaultSerializerFactory_defaultSubtypeResolver_defaultTypeFactory_defaultTypeResolverProvider_thisaccessorNamingactivateDefaultTypingactivateDefaultTypingactivateDefaultTypingactivateDefaultTypingAsPropertyaddAbstractTypeResolveraddHandleraddMixInaddMixInsaddModuleaddModulesaddModulesaddTypeModifierannotationIntrospectorannotationIntrospectorbaseSettingsbaseSettingsbuildDeserializationConfigbuildSerializationConfigcacheProviderchangeDefaultNullHandlingchangeDefaultPropertyInclusionchangeDefaultVisibilityclassIntrospectorclassIntrospectorclearProblemHandlersconfigureconfigureconfigureconfigureconfigureconfigureconfigureForJackson2constructorDetectordatatypeFeaturesdeactivateDefaultTypingdefaultAttributesdefaultAttributesdefaultBase64VariantdefaultDateFormatdefaultLeniencydefaultLocaledefaultMergeabledefaultPrettyPrinterdefaultPrettyPrinterdefaultTimeZonedeserializationContextsdeserializationContextsdeserializationProblemHandlersdeserializerFactorydeserializerFactorydisabledisabledisabledisabledisabledisableenableenableenableenableenableenableenumNamingStrategyfilterProviderfilterProviderfindAndAddModulesfindAndAddModulesfindModulesfindModuleshandlerInstantiatorinjectableValuesinjectableValuesisEnabledisEnabledisEnabledisEnabledisEnabledisEnabledmixInHandlermixInHandlermixInOverridesnodeFactorypolymorphicTypeValidatorpropertyNamingStrategyregisterSubtypesregisterSubtypesregisterSubtypesremoveAllModulesremoveMixInsaveStateApplyModulesserializationContextsserializationContextsserializerFactoryserializerFactorysetDefaultTypingstreamFactorysubtypeResolversubtypeResolvertypeFactorytypeFactorytypeResolverProvidertypeResolverProviderwithAllCoercionConfigswithAllConfigOverrideswithCoercionConfigwithCoercionConfigwithCoercionConfigDefaultswithConfigOverridewithModules

Constructor Detail

Builderback to summary
public Builder(AvroFactory f)
Builderback to summary
public Builder(AvroMapper.Builder.StateImpl state)

Method Detail

_saveStateback to summary
protected MapperBuilderState _saveState()

Implements abstract tools.jackson.databind.cfg.MapperBuilder._saveState.

Annotations
@Override
buildback to summary
public AvroMapper build()

Implements abstract tools.jackson.databind.cfg.MapperBuilder.build.

Doc from tools.jackson.databind.cfg.MapperBuilder.build.

Method to call to create actual mapper instance.

Implementation detail: usually construction occurs by passing this builder instance to constructor of specific mapper type builder builds.

Annotations
@Override
configureback to summary
public AvroMapper.Builder configure(AvroReadFeature feature, boolean state)
configureback to summary
public AvroMapper.Builder configure(AvroWriteFeature feature, boolean state)
disableback to summary
public AvroMapper.Builder disable(AvroReadFeature... features)
disableback to summary
public AvroMapper.Builder disable(AvroWriteFeature... features)
enableback to summary
public AvroMapper.Builder enable(AvroReadFeature... features)
enableback to summary
public AvroMapper.Builder enable(AvroWriteFeature... features)
tools.jackson.dataformat.avro back to summary

protected Class AvroMapper.Builder.StateImpl

extends MapperBuilderState
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Object
readResolve()

Implements abstract tools.jackson.databind.cfg.MapperBuilderState.readResolve.

Method required to support JDK deserialization; made `abstract` here to ensure sub-classes must implement it.

Inherited from tools.jackson.databind.cfg.MapperBuilderState:
modules

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.databind.cfg.MapperBuilderState.serialVersionUID.

Constructor Detail

StateImplback to summary
public StateImpl(AvroMapper.Builder src)

Method Detail

readResolveback to summary
protected Object readResolve()

Implements abstract tools.jackson.databind.cfg.MapperBuilderState.readResolve.

Doc from tools.jackson.databind.cfg.MapperBuilderState.readResolve.

Method required to support JDK deserialization; made `abstract` here to ensure sub-classes must implement it.

Annotations
@Override
tools.jackson.dataformat.avro back to summary

private final Class AvroMapper.SharedWrapper

extends Object
Class Inheritance

Helper class to contain dynamically constructed "shared" instance of mapper, should one be needed via shared.

Field Summary

Modifier and TypeField and Description
private static final AvroMapper

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static AvroMapper
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

MAPPERback to summary
private static final AvroMapper MAPPER

Constructor Detail

SharedWrapperback to summary
private SharedWrapper()

Method Detail

wrappedback to summary
public static AvroMapper wrapped()