Package org.cyclonedx.generators.json
Class BomJsonGenerator
java.lang.Object
org.cyclonedx.CycloneDxSchema
org.cyclonedx.generators.AbstractBomGenerator
org.cyclonedx.generators.json.BomJsonGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.fasterxml.jackson.core.util.DefaultPrettyPrinterFields inherited from class org.cyclonedx.generators.AbstractBomGenerator
bom, format, mapper, versionFields inherited from class org.cyclonedx.CycloneDxSchema
ALL_VERSIONS, NS_BOM_10, NS_BOM_11, NS_BOM_12, NS_BOM_13, NS_BOM_14, NS_BOM_15, NS_BOM_16, NS_BOM_LATEST, NS_DEPENDENCY_GRAPH_10, VERSION_LATEST -
Constructor Summary
ConstructorsConstructorDescriptionBomJsonGenerator(Bom bom, Version version) Constructs a new BomGenerator object. -
Method Summary
Modifier and TypeMethodDescriptionprivate Bomprivate voidprivate voidsetupPrettyPrinter(com.fasterxml.jackson.core.util.DefaultPrettyPrinter prettyPrinter) (package private) Stringcom.fasterxml.jackson.databind.JsonNodeCreates a CycloneDX BOM from a set of Components.toString()Creates a text representation of a CycloneDX BoM Document.Methods inherited from class org.cyclonedx.generators.AbstractBomGenerator
getFormat, getSchemaVersion, setupObjectMapperMethods inherited from class org.cyclonedx.CycloneDxSchema
getJsonSchema, getXmlSchema, getXmlSchema
-
Field Details
-
prettyPrinter
private final com.fasterxml.jackson.core.util.DefaultPrettyPrinter prettyPrinter
-
-
Constructor Details
-
BomJsonGenerator
Constructs a new BomGenerator object.- Parameters:
bom- the BOM to generateversion- the version of the CycloneDX schema to use.
-
-
Method Details
-
setupObjectMapper
private void setupObjectMapper() -
setupPrettyPrinter
private void setupPrettyPrinter(com.fasterxml.jackson.core.util.DefaultPrettyPrinter prettyPrinter) -
injectBomFormatAndSpecVersion
- Throws:
GeneratorException
-
toJsonNode
public com.fasterxml.jackson.databind.JsonNode toJsonNode()Creates a CycloneDX BOM from a set of Components.- Returns:
- an JSON Document representing a CycloneDX BoM
- Since:
- 7.0.0
-
toJsonString
- Throws:
GeneratorException
-
toString
Creates a text representation of a CycloneDX BoM Document. This method callstoJsonString()and will return an empty string iftoJsonString()throws an exception. It's preferred to calltoJsonString()directly so that exceptions can be caught. -
toJson
- Throws:
GeneratorException
-