Package org.apache.tika.config.loader
Class TikaObjectMapperFactory
java.lang.Object
org.apache.tika.config.loader.TikaObjectMapperFactory
Factory for creating ObjectMappers configured for Tika serialization.
Configures strict validation settings and loads component registries for friendly name resolution.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.fasterxml.jackson.databind.ObjectMapperCreates an ObjectMapper configured for Tika serialization.static com.fasterxml.jackson.databind.ObjectMappercreateMapper(com.fasterxml.jackson.core.JsonFactory factory) Creates an ObjectMapper configured for Tika serialization with a custom JsonFactory.static com.fasterxml.jackson.databind.ObjectMapperstatic com.fasterxml.jackson.databind.ObjectMapperReturns a shared plain ObjectMapper without TikaModule registration.
-
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_BEANSdisabled 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
-