Skip to content

Commit

Permalink
feat: add sources to convert CycloneDX 1.4 schema to POJO (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
algomaster99 authored Aug 17, 2023
1 parent 2fbeffa commit 1d626a8
Show file tree
Hide file tree
Showing 7 changed files with 2,591 additions and 0 deletions.
18 changes: 18 additions & 0 deletions terminator-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
<targetPackage>io.github.algomaster99.terminator.commons.cyclonedx</targetPackage>
<includes>*.json</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.github.algomaster99.terminator.commons.cyclonedx;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class CycloneDX {

private CycloneDX() {}

/**
* Converts the SBOM to a plain old java object
*/
public static Bom14Schema getPOJO(String bom) throws JsonProcessingException {
final ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(bom, Bom14Schema.class);
}
}
Loading

0 comments on commit 1d626a8

Please sign in to comment.