Package org.spdx.v3jsonldstore
Class JsonLDSerializer
- java.lang.Object
-
- org.spdx.v3jsonldstore.JsonLDSerializer
-
public class JsonLDSerializer extends Object
Serializer to serialize a model store containing SPDX Spec version 3 elementsThe
Theserialize()method will serialize the@graphfor all SPDX elements stored in the model store.serialize(SpdxElement element)will serialize a single element.- Author:
- Gary O'Neall
-
-
Constructor Summary
Constructors Constructor Description JsonLDSerializer(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, boolean pretty, boolean useExternalListedElements, String specVersion, org.spdx.storage.IModelStore modelStore)Serializer to serialize a model store containing SPDX 3 elements
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonLDSchemagetSchema()Returns the JSON-LD schema used for serializationcom.fasterxml.jackson.databind.JsonNodeserialize(org.spdx.core.CoreModelObject objectToSerialize)
-
-
-
Constructor Detail
-
JsonLDSerializer
public JsonLDSerializer(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, boolean pretty, boolean useExternalListedElements, String specVersion, org.spdx.storage.IModelStore modelStore) throws net.jimblackler.jsonschemafriend.GenerationExceptionSerializer to serialize a model store containing SPDX 3 elements- Parameters:
jsonMapper- mapper to use for serializationpretty- true if the format is to be more verboseuseExternalListedElements- if true, don't serialize any listed licenses or exceptions - treat them as externalspecVersion- SemVer representation of the SPDX spec versionmodelStore- store where the SPDX elements are stored- Throws:
net.jimblackler.jsonschemafriend.GenerationException- if the JSON schema is not found or is not valid
-
-
Method Detail
-
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 retrieving the information for serialization
-
getSchema
public JsonLDSchema getSchema()
Returns the JSON-LD schema used for serialization- Returns:
- JSON-LD Schema
-
-