Class SerializerUtils
java.lang.Object
org.cyclonedx.util.serializer.SerializerUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<ExternalReference> filterExternalReferencesByVersion(List<ExternalReference> refs, Version version) Filters a list of ExternalReferences, removing entries whose Type has aVersionFilterabove the target version.filterHashesByVersion(List<Hash> hashes, Version version) Filters a list of Hashes, removing entries whose Algorithm has aVersionFilterabove the target version.static voidserializeHashJson(com.fasterxml.jackson.core.JsonGenerator gen, Hash hash) static voidserializeHashXml(com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator toXmlGenerator, Hash hash) static voidserializeProperty(String propertyName, Property prop, com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator xmlGenerator) static booleanshouldSerializeEnumValue(Enum<?> enumValue, Version version) Checks whether an enum constant should be serialized for the target version by inspecting theVersionFilterannotation on the enum constant's field.static booleanshouldSerializeField(Object obj, Version version, String fieldName) static voidwriteField(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, String fieldName, Object fieldValue)
-
Constructor Details
-
SerializerUtils
public SerializerUtils()
-
-
Method Details
-
serializeHashXml
public static void serializeHashXml(com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator toXmlGenerator, Hash hash) throws IOException - Throws:
IOException
-
serializeHashJson
public static void serializeHashJson(com.fasterxml.jackson.core.JsonGenerator gen, Hash hash) throws IOException - Throws:
IOException
-
shouldSerializeField
-
shouldSerializeEnumValue
Checks whether an enum constant should be serialized for the target version by inspecting theVersionFilterannotation on the enum constant's field.- Parameters:
enumValue- the enum constant to checkversion- the target BOM version being generated- Returns:
- true if the enum value is valid for the target version, false otherwise
-
filterExternalReferencesByVersion
public static List<ExternalReference> filterExternalReferencesByVersion(List<ExternalReference> refs, Version version) Filters a list of ExternalReferences, removing entries whose Type has aVersionFilterabove the target version. -
filterHashesByVersion
-
serializeProperty
public static void serializeProperty(String propertyName, Property prop, com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator xmlGenerator) throws IOException - Throws:
IOException
-
writeField
public static void writeField(com.fasterxml.jackson.core.JsonGenerator jsonGenerator, String fieldName, Object fieldValue) throws IOException - Throws:
IOException
-