Class JsonLDSerializer

java.lang.Object
org.spdx.v3jsonldstore.JsonLDSerializer

public class JsonLDSerializer extends Object
Author:
Gary O'Neall Serializer to serialize a model store containing SPDX Spec version 3 elements The serialize() method will serialize the @graph for all SPDX elements stored in the model store. The serialize(SpdxElement element) will serialize a single element
  • Constructor Details

    • JsonLDSerializer

      public JsonLDSerializer(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, boolean pretty, boolean useExternalListedElements, String specVersion, org.spdx.storage.IModelStore modelStore) throws net.jimblackler.jsonschemafriend.GenerationException
      Parameters:
      jsonMapper - mapper to use for serialization
      pretty - true if the format is to be more verbose
      useExternalListedElements - if true, don't serialize any listed licenses or exceptions - treat them as external
      specVersion - SemVer representation of the SPDX spec version
      modelStore - store where the SPDX elements are stored
      Throws:
      net.jimblackler.jsonschemafriend.GenerationException - if the JSON schema is not found or is not valid
  • Method Details

    • serialize

      public com.fasterxml.jackson.databind.JsonNode serialize(@Nullable org.spdx.core.CoreModelObject objectToSerialize) throws org.spdx.core.InvalidSPDXAnalysisException
      Parameters:
      objectToSerialize - optional SPDX Document or single element to serialize
      Returns:
      the root node of the JSON serialization
      Throws:
      org.spdx.core.InvalidSPDXAnalysisException - on errors retrieveing the information for serialization
    • getSchema

      public JsonLDSchema getSchema()
      Returns:
      JSON LD Schema