Class JacksonVersionBridge
java.lang.Object
com.flipkart.zjsonpatch.mapping.JacksonVersionBridge
Bridge for wrapping and unwrapping Jackson JsonNodes across different versions.
This class handles the bridging responsibility - converting between native Jackson nodes and wrapped nodes. It automatically detects the Jackson version of nodes by checking if they are instances of known Jackson JsonNode types, properly handling inheritance and subclassed nodes.
- Since:
- 0.6.0
- Author:
- Mariusz Sondecki
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tunwrap(JsonNodeWrapper wrapper) Unwraps a JsonNodeWrapper to its underlying Jackson JsonNode.static JsonNodeWrapperWraps a native Jackson JsonNode in the appropriate JsonNodeWrapper.
-
Method Details
-
wrap
Wraps a native Jackson JsonNode in the appropriate JsonNodeWrapper.- Parameters:
nativeNode- the Jackson JsonNode to wrap- Returns:
- wrapped JsonNode, or null if input is null
- Throws:
IllegalArgumentException- if the node type is unsupported for the selected Jackson versionJacksonVersionException- if wrapper classes cannot be loaded or instantiated
-
unwrap
Unwraps a JsonNodeWrapper to its underlying Jackson JsonNode.- Parameters:
wrapper- the wrapper to unwrap- Returns:
- the underlying Jackson JsonNode, or null if wrapper is null
-