Top Description Inners Fields Constructors Methods
com.fasterxml.jackson.dataformat.avro

public Class AvroMapper

extends ObjectMapper
Class Inheritance
Imports
java.io.File, .IOException, .InputStream, org.apache.avro.Schema, com.fasterxml.jackson.core.JsonGenerator, .Version, com.fasterxml.jackson.databind.JavaType, .JsonMappingException, .Module, .ObjectMapper, com.fasterxml.jackson.databind.cfg.MapperBuilder, com.fasterxml.jackson.databind.exc.InvalidDefinitionException, com.fasterxml.jackson.databind.util.ClassUtil, com.fasterxml.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.
Since
2.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
AvroMapper.Builder

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

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from com.fasterxml.jackson.databind.ObjectMapper:
_coercionConfigs_configOverrides_deserializationConfig_deserializationContext_injectableValues_jsonFactory_mixIns_registeredModuleTypes_rootDeserializers_serializationConfig_serializerFactory_serializerProvider_subtypeResolver_typeFactoryDEFAULT_ANNOTATION_INTROSPECTORDEFAULT_BASE

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
AvroMapper(Module... modules)

Constructor that will construct mapper with standard AvroFactory as codec, and register given modules but nothing else (that is, will only register AvroModule if it's included as argument.

public
AvroMapper(AvroFactory f, Module... modules)

Constructor that will construct mapper with specified AvroFactory as codec, and register given modules but nothing else (that is, will only register AvroModule if it's included as argument.

protected

Method Summary

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

public AvroMapper
copy()

Overrides com.fasterxml.jackson.databind.ObjectMapper.copy.

Method for creating a new ObjectMapper instance that has same initial configuration as this instance.

public AvroFactory
getFactory()

Overrides com.fasterxml.jackson.databind.ObjectMapper.getFactory.

Accessor for finding underlying data format factory (JsonFactory) codec will use for data binding.

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 Version
version()

Overrides com.fasterxml.jackson.databind.ObjectMapper.version.

Implements com.fasterxml.jackson.core.Versioned.version.

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

public static AvroMapper.Builder
Inherited from com.fasterxml.jackson.databind.ObjectMapper:
_assertNotNull_checkInvalidCopy_configAndWriteValue_constructDefaultTypeResolverBuilder_convert_findRootDeserializer_initForReading_newReader_newReader_newWriter_newWriter_newWriter_readMapAndClose_readTreeAndClose_readValue_serializerProvider_verifyNoTrailingTokens_verifySchemaType_writeValueAndCloseacceptJsonFormatVisitoracceptJsonFormatVisitoractivateDefaultTypingactivateDefaultTypingactivateDefaultTypingactivateDefaultTypingAsPropertyaddHandleraddMixInaddMixInAnnotationscanDeserializecanDeserializecanSerializecanSerializeclearProblemHandlerscoercionConfigDefaultscoercionConfigForcoercionConfigForconfigOverrideconfigureconfigureconfigureconfigureconfigureconfigureconstructTypeconstructTypeconvertValueconvertValueconvertValuecopyWithcreateArrayNodecreateDeserializationContextcreateGeneratorcreateGeneratorcreateGeneratorcreateGeneratorcreateGeneratorcreateNonBlockingByteArrayParsercreateObjectNodecreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParserdeactivateDefaultTypingdefaultClassIntrospectordisabledisabledisabledisabledisabledisabledisabledisableDefaultTypingenableenableenableenableenableenableenableenableDefaultTypingenableDefaultTypingenableDefaultTypingenableDefaultTypingAsPropertyfindAndRegisterModulesfindMixInClassForfindModulesfindModulesgenerateJsonSchemagetDateFormatgetDeserializationConfiggetDeserializationContextgetInjectableValuesgetNodeFactorygetPolymorphicTypeValidatorgetPropertyNamingStrategygetRegisteredModuleIdsgetSerializationConfiggetSerializerFactorygetSerializerProvidergetSerializerProviderInstancegetSubtypeResolvergetTypeFactorygetVisibilityCheckerisEnabledisEnabledisEnabledisEnabledisEnabledisEnabledisEnabledisEnabledmissingNodemixInCountnullNodereaderreaderreaderreaderreaderreaderreaderreaderreaderreaderreaderreaderForreaderForreaderForreaderForArrayOfreaderForListOfreaderForMapOfreaderForUpdatingreaderWithViewreadTreereadTreereadTreereadTreereadTreereadTreereadTreereadTreereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuesreadValuesreadValuesreadValuesregisterModuleregisterModulesregisterModulesregisterSubtypesregisterSubtypesregisterSubtypessetAccessorNamingsetAnnotationIntrospectorsetAnnotationIntrospectorssetBase64VariantsetCacheProvidersetConfigsetConfigsetConstructorDetectorsetDateFormatsetDefaultAttributessetDefaultLeniencysetDefaultMergeablesetDefaultPrettyPrintersetDefaultPropertyInclusionsetDefaultPropertyInclusionsetDefaultSetterInfosetDefaultTypingsetDefaultVisibilitysetFilterProvidersetFilterssetHandlerInstantiatorsetInjectableValuessetLocalesetMixInAnnotationssetMixInResolversetMixInssetNodeFactorysetPolymorphicTypeValidatorsetPropertyInclusionsetPropertyNamingStrategysetSerializationInclusionsetSerializerFactorysetSerializerProvidersetSubtypeResolversetTimeZonesetTypeFactorysetVisibilitysetVisibilitysetVisibilityCheckertokenStreamFactorytreeAsTokenstreeToValuetreeToValuetreeToValueupdateValuevalueToTreewriterwriterwriterwriterwriterwriterwriterwriterwriterwriterwriterForwriterForwriterForwriterWithDefaultPrettyPrinterwriterWithTypewriterWithTypewriterWithTypewriterWithViewwriteTreewriteTreewriteValuewriteValuewriteValuewriteValuewriteValuewriteValueAsByteswriteValueAsString

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.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(Module... modules)

Constructor that will construct mapper with standard AvroFactory as codec, and register given modules but nothing else (that is, will only register AvroModule if it's included as argument.

AvroMapperback to summary
public AvroMapper(AvroFactory f, Module... modules)

Constructor that will construct mapper with specified AvroFactory as codec, and register given modules but nothing else (that is, will only register AvroModule if it's included as argument.

AvroMapperback to summary
protected AvroMapper(ObjectMapper src)

Method Detail

_invalidSchemaDefinitionback to summary
protected JsonMappingException _invalidSchemaDefinition(JavaType type, Exception e0)
builderback to summary
public static AvroMapper.Builder builder()
Since
2.10
builderback to summary
public static AvroMapper.Builder builder(AvroFactory streamFactory)
copyback to summary
public AvroMapper copy()

Overrides com.fasterxml.jackson.databind.ObjectMapper.copy.

Doc from com.fasterxml.jackson.databind.ObjectMapper.copy.

Method for creating a new ObjectMapper instance that has same initial configuration as this instance. Note that this also requires making a copy of the underlying JsonFactory instance.

Method is typically used when multiple, differently configured mappers are needed. Although configuration is shared, cached serializers and deserializers are NOT shared, which means that the new instance may be re-configured before use; meaning that it behaves the same way as if an instance was constructed from scratch.

Annotations
@Override
getFactoryback to summary
public AvroFactory getFactory()

Overrides com.fasterxml.jackson.databind.ObjectMapper.getFactory.

Doc from com.fasterxml.jackson.core.ObjectCodec.getFactory.

Accessor for finding underlying data format factory (JsonFactory) codec will use for data binding.

Returns:AvroFactory

Underlying JsonFactory instance

Annotations
@Override
schemaForback to summary
public AvroSchema schemaFor(Class<?> type) throws JsonMappingException

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.

Since
2.5
schemaForback to summary
public AvroSchema schemaFor(JavaType type) throws JsonMappingException

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.

Since
2.5
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.

Since
2.6
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.

Since
2.6
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.

Since
2.6
versionback to summary
public Version version()

Overrides com.fasterxml.jackson.databind.ObjectMapper.version.

Implements com.fasterxml.jackson.core.Versioned.version.

Doc from com.fasterxml.jackson.databind.ObjectMapper.version.

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

Returns:Version

Doc from com.fasterxml.jackson.core.Versioned.version.

Version of the component

Annotations
@Override
xmlBuilderback to summary
public static AvroMapper.Builder xmlBuilder()
Since
2.10
com.fasterxml.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
2.10

Field Summary

Modifier and TypeField and Description
protected final AvroFactory
Inherited from com.fasterxml.jackson.databind.cfg.MapperBuilder:
_mapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public AvroMapper.Builder
configure(AvroParser.Feature f, boolean state)

public AvroMapper.Builder
configure(AvroGenerator.Feature f, boolean state)

public AvroMapper.Builder
disable(AvroParser.Feature... features)

public AvroMapper.Builder
public AvroMapper.Builder
enable(AvroParser.Feature... features)

public AvroMapper.Builder
Inherited from com.fasterxml.jackson.databind.cfg.MapperBuilder:
_thisaccessorNamingactivateDefaultTypingactivateDefaultTypingactivateDefaultTypingactivateDefaultTypingAsPropertyaddHandleraddMixInaddModuleaddModulesaddModulesannotationIntrospectorbuildcacheProviderclearProblemHandlersconfigureconfigureconfigureconfigureconfigureconfigureconfigureconfigureconstructorDetectordeactivateDefaultTypingdefaultAttributesdefaultBase64VariantdefaultDateFormatdefaultLeniencydefaultLocaledefaultMergeabledefaultPrettyPrinterdefaultPropertyInclusiondefaultSetterInfodefaultTimeZonedisabledisabledisabledisabledisabledisabledisabledisableenableenableenableenableenableenableenableenablefilterProviderfindAndAddModulesfindModulesfindModuleshandlerInstantiatorinjectableValuesisEnabledisEnabledisEnabledisEnabledisEnablednodeFactorypolymorphicTypeValidatorpropertyNamingStrategyregisterSubtypesregisterSubtypesregisterSubtypesremoveMixInserializationInclusionserializerFactorysetDefaultTypingstreamFactorysubtypeResolvertypeFactoryvisibilityvisibilitywithCoercionConfigwithCoercionConfigwithCoercionConfigDefaultswithConfigOverride

Field Detail

_streamFactoryback to summary
protected final AvroFactory _streamFactory

Constructor Detail

Builderback to summary
public Builder(AvroMapper m)

Method Detail

configureback to summary
public AvroMapper.Builder configure(AvroParser.Feature f, boolean state)
configureback to summary
public AvroMapper.Builder configure(AvroGenerator.Feature f, boolean state)
disableback to summary
public AvroMapper.Builder disable(AvroParser.Feature... features)
disableback to summary
public AvroMapper.Builder disable(AvroGenerator.Feature... features)
enableback to summary
public AvroMapper.Builder enable(AvroParser.Feature... features)
enableback to summary
public AvroMapper.Builder enable(AvroGenerator.Feature... features)