Class ParseContextDeserializer
java.lang.Object
com.fasterxml.jackson.databind.JsonDeserializer<ParseContext>
org.apache.tika.serialization.serdes.ParseContextDeserializer
- All Implemented Interfaces:
com.fasterxml.jackson.databind.deser.NullValueProvider
public class ParseContextDeserializer
extends com.fasterxml.jackson.databind.JsonDeserializer<ParseContext>
Deserializes ParseContext from JSON.
Handles two types of entries:
- "typed" section: Deserialized directly to typed objects in the context map
- Other entries: Stored as JSON configs for lazy resolution
Example input:
{
"typed": {
"handler-config": {"type": "XML", "parseMode": "RMETA"}
},
"metadata-filters": ["mock-upper-case-filter"]
}
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonDeserializer
com.fasterxml.jackson.databind.JsonDeserializer.None -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext ctxt) static ParseContextreadParseContext(com.fasterxml.jackson.databind.JsonNode jsonNode, com.fasterxml.jackson.databind.ObjectMapper mapper) Deserializes a ParseContext from a JsonNode.Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer
deserialize, deserializeWithType, deserializeWithType, findBackReference, getAbsentValue, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getNullValue, getObjectIdReader, handledType, isCachable, logicalType, replaceDelegatee, supportsUpdate, unwrappingDeserializer
-
Constructor Details
-
ParseContextDeserializer
public ParseContextDeserializer()
-
-
Method Details
-
deserialize
public ParseContext deserialize(com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext ctxt) throws IOException - Specified by:
deserializein classcom.fasterxml.jackson.databind.JsonDeserializer<ParseContext>- Throws:
IOException
-
readParseContext
public static ParseContext readParseContext(com.fasterxml.jackson.databind.JsonNode jsonNode, com.fasterxml.jackson.databind.ObjectMapper mapper) throws IOException Deserializes a ParseContext from a JsonNode.The "typed" section is deserialized directly to typed objects in the context map. All other fields are stored as JSON config strings for lazy resolution.
Duplicate detection is performed within a single document: if multiple entries resolve to the same context key (e.g., both "bouncy-castle-digester" and "commons-digester" resolve to DigesterFactory), an IOException is thrown.
- Parameters:
jsonNode- the JSON node containing the ParseContext datamapper- the ObjectMapper for deserializing typed objects- Returns:
- the deserialized ParseContext
- Throws:
IOException- if deserialization fails or duplicate context keys are detected
-