java.lang.Object
tools.jackson.databind.ObjectMapper
tools.jackson.dataformat.avro.AvroMapper
All Implemented Interfaces:
Serializable, tools.jackson.core.TreeCodec<tools.jackson.databind.JsonNode>, tools.jackson.core.Versioned

public class AvroMapper extends tools.jackson.databind.ObjectMapper
Convenience AvroMapper, which is mostly similar to simply constructing a mapper with AvroFactory, but also adds little bit of convenience around AvroSchema generation.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Base implementation for "Vanilla" ObjectMapper, used with Avro backend.
  • Field Summary

    Fields inherited from class tools.jackson.databind.ObjectMapper

    _deserializationConfig, _deserializationContexts, _injectableValues, _rootDeserializers, _savedBuilderState, _serializationConfig, _serializationContexts, _streamFactory, _typeFactory
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor that will construct mapper with standard AvroFactory as codec, and will also register AvroModule.
    Constructor that will construct mapper with given AvroFactory, as well as register standard AvroModule (with default settings).
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected tools.jackson.core.JacksonException
    _invalidSchemaDefinition(tools.jackson.databind.JavaType type, Exception e0)
     
     
    builder(AvroFactory streamFactory)
     
    boolean
     
    boolean
     
     
    schemaFor(Class<?> type)
    Factory method for constructing AvroSchema by introspecting given POJO type and building schema that contains specified properties.
    schemaFor(tools.jackson.databind.JavaType type)
    Factory method for constructing AvroSchema by introspecting given POJO type and building schema that contains specified properties.
    schemaFrom(File schemaFile)
    Convenience method for reading AvroSchema from given encoded JSON representation.
    Method for reading an Avro Schema from given InputStream, and once done (successfully or not), closing the stream.
    schemaFrom(String schemaAsString)
    Convenience method for reading AvroSchema from given encoded JSON representation.
    static AvroMapper
    Accessor method for getting globally shared "default" AvroMapper instance: one that has default configuration, no modules registered, no config overrides.
     
    tools.jackson.core.Version
     

    Methods inherited from class tools.jackson.databind.ObjectMapper

    _assertNotNull, _configAndWriteValue, _convert, _deserializationContext, _deserializationContext, _deserializationContext, _findRootDeserializer, _initForReading, _newReader, _newReader, _newWriter, _newWriter, _newWriter, _readMapAndClose, _readTreeAndClose, _readValue, _serializationContext, _serializationContext, _verifyNoTrailingTokens, _verifySchemaType, _writeCloseableValue, acceptJsonFormatVisitor, acceptJsonFormatVisitor, acceptJsonFormatVisitor, booleanNode, clearCaches, constructType, constructType, convertValue, convertValue, convertValue, createArrayNode, createGenerator, createGenerator, createGenerator, createGenerator, createGenerator, createGenerator, createNonBlockingByteArrayParser, createNonBlockingByteBufferParser, createObjectNode, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, deserializationConfig, getInjectableValues, getNodeFactory, getTypeFactory, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, missingNode, nullNode, reader, reader, reader, reader, reader, reader, reader, reader, reader, readerFor, readerFor, readerFor, readerForArrayOf, readerForListOf, readerForMapOf, readerForUpdating, readerWithView, readResolve, readTree, readTree, readTree, readTree, readTree, readTree, readTree, readTree, readTree, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValues, readValues, readValues, registeredModules, serializationConfig, stringNode, treeAsTokens, treeToValue, treeToValue, treeToValue, treeToValue, treeToValue, treeToValue, updateValue, valueToTree, writer, writer, writer, writer, writer, writer, writer, writer, writer, writer, writeReplace, writerFor, writerFor, writerFor, writerWithDefaultPrettyPrinter, writerWithView, writeTree, writeValue, writeValue, writeValue, writeValue, writeValue, writeValue, writeValueAsBytes, writeValueAsString, writeValueIntoBuffer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AvroMapper

      public AvroMapper()
      Constructor that will construct mapper with standard AvroFactory as codec, and will also register AvroModule.
    • AvroMapper

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

      public AvroMapper(AvroMapper.Builder b)
  • Method Details

    • builder

      public static AvroMapper.Builder builder()
    • builder

      public static AvroMapper.Builder builder(AvroFactory streamFactory)
    • rebuild

      public AvroMapper.Builder rebuild()
      Overrides:
      rebuild in class tools.jackson.databind.ObjectMapper
    • shared

      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.
    • version

      public tools.jackson.core.Version version()
      Specified by:
      version in interface tools.jackson.core.Versioned
      Overrides:
      version in class tools.jackson.databind.ObjectMapper
    • tokenStreamFactory

      public AvroFactory tokenStreamFactory()
      Overrides:
      tokenStreamFactory in class tools.jackson.databind.ObjectMapper
    • isEnabled

      public boolean isEnabled(AvroReadFeature f)
    • isEnabled

      public boolean isEnabled(AvroWriteFeature f)
    • schemaFor

      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.

    • schemaFor

      public AvroSchema schemaFor(tools.jackson.databind.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.

    • _invalidSchemaDefinition

      protected tools.jackson.core.JacksonException _invalidSchemaDefinition(tools.jackson.databind.JavaType type, Exception e0)
    • schemaFrom

      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.

      Throws:
      IOException
    • schemaFrom

      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.

      Throws:
      IOException
    • schemaFrom

      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.

      Throws:
      IOException