Package fr.gouv.vitam.common.json

# Class AbstractJsonType

java.lang.Object
fr.gouv.vitam.common.json.AbstractJsonType

public abstract class AbstractJsonType extends Object
Default base class for Data stored as Json or Xml. Any DTO class can use this class to extend from.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractJsonType()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `com.fasterxml.jackson.databind.node.ObjectNode`
  `generateJson()`
  Generates Json
  `String`
  `generateJsonString()`
  `static AbstractJsonType`
  `readJsonFile(File file)`
  `static AbstractJsonType`
  `readJsonString(String data)`
  `void`
  `writeJsonToFile(File file)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AbstractJsonType

    public AbstractJsonType()

- ## Method Details

  - ### generateJson

    public com.fasterxml.jackson.databind.node.ObjectNode generateJson()
    Generates Json
    Returns:
      the corresponding JsonNode

  - ### generateJsonString

    public String generateJsonString() throws InvalidParseOperationException
    Returns:
      the XML string representation
    Throws:
      `InvalidParseOperationException` - if parse exception occurred when writing a JsonNode

  - ### writeJsonToFile

    public void writeJsonToFile(File file) throws InvalidParseOperationException
    Parameters:
      `file` - the file to write
    Throws:
      `InvalidParseOperationException` - when parse exception occurred when writing a JsonNode
      `IllegalArgumentException` - if file null

  - ### readJsonFile

    public static AbstractJsonType readJsonFile(File file) throws InvalidParseOperationException
    Parameters:
      `file` - to write
    Returns:
      the associated object
    Throws:
      `InvalidParseOperationException` - if parse exception occurred when reading file in json object
      `IllegalArgumentException` - if file null

  - ### readJsonString

    public static AbstractJsonType readJsonString(String data) throws InvalidParseOperationException
    Parameters:
      `data` - as String to read
    Returns:
      the associated object
    Throws:
      `InvalidParseOperationException` - if parse exception occurred when reading file in json object
      `IllegalArgumentException` - if data null