Class TikaObjectMapperFactory

java.lang.Object
org.apache.tika.config.loader.TikaObjectMapperFactory

public class TikaObjectMapperFactory extends Object
Factory for creating ObjectMappers configured for Tika serialization.

Configures strict validation settings and loads component registries for friendly name resolution.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.fasterxml.jackson.databind.ObjectMapper
    Creates an ObjectMapper configured for Tika serialization.
    static com.fasterxml.jackson.databind.ObjectMapper
    createMapper(com.fasterxml.jackson.core.JsonFactory factory)
    Creates an ObjectMapper configured for Tika serialization with a custom JsonFactory.
    static com.fasterxml.jackson.databind.ObjectMapper
     
    static com.fasterxml.jackson.databind.ObjectMapper
    Returns a shared plain ObjectMapper without TikaModule registration.

    Methods inherited from class java.lang.Object

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

    • TikaObjectMapperFactory

      public TikaObjectMapperFactory()
  • Method Details

    • getPlainMapper

      public static com.fasterxml.jackson.databind.ObjectMapper getPlainMapper()
      Returns a shared plain ObjectMapper without TikaModule registration.

      This mapper is suitable for:

      • Converting JsonNodes to JSON strings
      • Serializing component properties without compact format wrapping
      • Avoiding infinite recursion when serializing inside TikaModule

      Has FAIL_ON_EMPTY_BEANS disabled to allow serialization of classes with no properties.

      Returns:
      the shared plain ObjectMapper
    • getMapper

      public static com.fasterxml.jackson.databind.ObjectMapper getMapper()
    • createMapper

      public static com.fasterxml.jackson.databind.ObjectMapper createMapper()
      Creates an ObjectMapper configured for Tika serialization.
      Returns:
      configured ObjectMapper
    • createMapper

      public static com.fasterxml.jackson.databind.ObjectMapper createMapper(com.fasterxml.jackson.core.JsonFactory factory)
      Creates an ObjectMapper configured for Tika serialization with a custom JsonFactory.

      This can be used to create mappers for binary formats like Smile:

       ObjectMapper smileMapper = TikaObjectMapperFactory.createMapper(new SmileFactory());
       
      Parameters:
      factory - the JsonFactory to use, or null for default JSON
      Returns:
      configured ObjectMapper