Package fr.gouv.vitam.common.json
Class AbstractJsonType
java.lang.Object
fr.gouv.vitam.common.json.AbstractJsonType
Default base class for Data stored as Json or Xml.
Any DTO class can use this class to extend from.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.node.ObjectNode
Generates Jsonstatic AbstractJsonType
readJsonFile
(File file) static AbstractJsonType
readJsonString
(String data) void
writeJsonToFile
(File file)
-
Constructor Details
-
AbstractJsonType
public AbstractJsonType()
-
-
Method Details
-
generateJson
public com.fasterxml.jackson.databind.node.ObjectNode generateJson()Generates Json- Returns:
- the corresponding JsonNode
-
generateJsonString
- Returns:
- the XML string representation
- Throws:
InvalidParseOperationException
- if parse exception occurred when writing a JsonNode
-
writeJsonToFile
- Parameters:
file
- the file to write- Throws:
InvalidParseOperationException
- when parse exception occurred when writing a JsonNodeIllegalArgumentException
- if file null
-
readJsonFile
- Parameters:
file
- to write- Returns:
- the associated object
- Throws:
InvalidParseOperationException
- if parse exception occurred when reading file in json objectIllegalArgumentException
- if file null
-
readJsonString
- Parameters:
data
- as String to read- Returns:
- the associated object
- Throws:
InvalidParseOperationException
- if parse exception occurred when reading file in json objectIllegalArgumentException
- if data null
-