Package org.openmetadata.service.util
Class JsonUtils
java.lang.Object
org.openmetadata.service.util.JsonUtils
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic javax.json.JsonValueapplyPatch(Object original, javax.json.JsonPatch patch) Applies the patch on original object and returns the updated objectstatic <T> TapplyPatch(T original, javax.json.JsonPatch patch, Class<T> clz) static booleanCompared the canonicalized JSON representation of two object to check if they are equals or notstatic <T> TconvertValue(Object object, com.fasterxml.jackson.core.type.TypeReference<T> toValueTypeRef) static <T> TconvertValue(Object object, Class<T> clz) static <T> Tstatic <T> TextractValue(com.fasterxml.jackson.databind.JsonNode jsonNode, String... keys) static <T> TextractValue(String jsonResponse, String... keys) static TypegetEntityType(String jsonSchemaFile) Get all the fields types from the `definitions` section of a JSON schema file that are annotated with "$comment" field set to "@om-entity-type".getFieldTypes(String jsonSchemaFile) Get all the fields types from the `definitions` section of a JSON schema file that are annotated with "$comment" field set to "@om-field-type".static javax.json.JsonPatchgetJsonPatch(Object v1, Object v2) static javax.json.JsonPatchgetJsonPatch(String v1, String v2) static com.networknt.schema.JsonSchemagetJsonSchema(String schema) static javax.json.JsonStructurestatic com.fasterxml.jackson.databind.node.ObjectNodestatic com.fasterxml.jackson.databind.node.ObjectNodegetObjectNode(String key, com.fasterxml.jackson.databind.JsonNode value) getTypes()Get all the fields types and entity types from OpenMetadata JSON schema definition files.static booleanhasAnnotation(com.fasterxml.jackson.databind.JsonNode jsonNode, String annotation) static StringpojoToJson(Object o) static StringpojoToJson(Object o, boolean prettyPrint) static StringpojoToMaskedJson(Object entity) Serialize object removing all the fields annotated with @MaskedFieldstatic javax.json.JsonValuestatic <T> List<T>readObjects(String json, Class<T> clz) Read an array of objects of typeTfrom jsonstatic <T> List<T>readObjects(List<String> jsons, Class<T> clz) Read an object of typeTfrom jsonstatic <T> TreadOrConvertValue(Object obj, Class<T> clz) static com.fasterxml.jackson.databind.JsonNodestatic <T> Tstatic <T> Tstatic <T> Tstatic <T> TtoExposedEntity(Object entity, Class<T> clazz) Serialize object removing all the fields annotated with @ExposedFieldstatic <T> TtreeToValue(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<T> classType) static com.fasterxml.jackson.databind.JsonNodevalueToTree(Object object)
-
Field Details
-
FIELD_TYPE_ANNOTATION
- See Also:
-
ENTITY_TYPE_ANNOTATION
- See Also:
-
JSON_FILE_EXTENSION
- See Also:
-
-
Method Details
-
pojoToJson
-
pojoToJson
-
getJsonStructure
-
getMap
-
readOrConvertValue
-
readValue
-
readValue
-
readValue
public static <T> T readValue(String json, com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef) -
readObjects
Read an array of objects of typeTfrom json -
readObjects
Read an object of typeTfrom json -
convertValue
-
convertValue
public static <T> T convertValue(Object object, com.fasterxml.jackson.core.type.TypeReference<T> toValueTypeRef) -
applyPatch
Applies the patch on original object and returns the updated object -
applyPatch
-
getJsonPatch
-
getJsonPatch
-
readJson
-
getJsonSchema
-
valueToTree
-
hasAnnotation
public static boolean hasAnnotation(com.fasterxml.jackson.databind.JsonNode jsonNode, String annotation) -
getTypes
Get all the fields types and entity types from OpenMetadata JSON schema definition files. -
getFieldTypes
Get all the fields types from the `definitions` section of a JSON schema file that are annotated with "$comment" field set to "@om-field-type". -
getEntityType
Get all the fields types from the `definitions` section of a JSON schema file that are annotated with "$comment" field set to "@om-entity-type". -
pojoToMaskedJson
Serialize object removing all the fields annotated with @MaskedField -
toExposedEntity
Serialize object removing all the fields annotated with @ExposedField -
getObjectNode
public static com.fasterxml.jackson.databind.node.ObjectNode getObjectNode(String key, com.fasterxml.jackson.databind.JsonNode value) -
getObjectNode
public static com.fasterxml.jackson.databind.node.ObjectNode getObjectNode() -
readTree
-
treeToValue
public static <T> T treeToValue(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<T> classType) -
areEquals
Compared the canonicalized JSON representation of two object to check if they are equals or not -
deepCopy
-
extractValue
-
extractValue
-