Class JsonLDSerializer
java.lang.Object
org.spdx.v3jsonldstore.JsonLDSerializer
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.
serialize(SpdxElement element) will serialize a single element.- Author:
- Gary O'Neall
-
Constructor Summary
ConstructorsConstructorDescriptionJsonLDSerializer(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, boolean pretty, boolean useExternalListedElements, String specVersion, IModelStore modelStore) Serializer to serialize a model store containing SPDX 3 elements -
Method Summary
Modifier and TypeMethodDescriptionReturns the JSON-LD schema used for serializationcom.fasterxml.jackson.databind.JsonNodeserialize(CoreModelObject objectToSerialize)
-
Constructor Details
-
JsonLDSerializer
public JsonLDSerializer(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, boolean pretty, boolean useExternalListedElements, String specVersion, IModelStore modelStore) throws net.jimblackler.jsonschemafriend.GenerationException Serializer 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 Details
-
serialize
public com.fasterxml.jackson.databind.JsonNode serialize(@Nullable CoreModelObject objectToSerialize) throws InvalidSPDXAnalysisException - Parameters:
objectToSerialize- optional SPDX Document or single element to serialize- Returns:
- the root node of the JSON serialization
- Throws:
InvalidSPDXAnalysisException- on errors retrieving the information for serialization
-
getSchema
Returns the JSON-LD schema used for serialization- Returns:
- JSON-LD Schema
-