Package dev.harrel.jsonschema
Interface JsonNodeFactory
- All Known Implementing Classes:
GsonNode.Factory,JacksonNode.Factory,JakartaJsonNode.Factory,JettisonNode.Factory,JsonSmartNode.Factory,OrgJsonNode.Factory
public interface JsonNodeFactory
JsonNodeFactory interface is the main abstraction for provider-agnostic JSON factory.-
Method Summary
-
Method Details
-
wrap
Wraps provider specific JSON node intoJsonNode. Main purpose of this method is to avoid additional JSON parsing. If passed object is alreadyJsonNodeit should be returned directly.- Parameters:
node- provider specific representation of JSON node- Returns:
- wrapped node
- Throws:
RuntimeException- when provided node is of invalid type
-
create
CreatesJsonNodefrom raw JSON string.- Parameters:
rawJson- JSON in string form- Returns:
- created node
- Throws:
RuntimeException- when creation fails for any reasons (e.g. provided string is not a valid JSON)
-