Class SerializerUtils

java.lang.Object
org.cyclonedx.util.serializer.SerializerUtils

public class SerializerUtils extends Object
  • 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

      public static boolean shouldSerializeField(Object obj, Version version, String fieldName)
    • shouldSerializeEnumValue

      public static boolean shouldSerializeEnumValue(Enum<?> enumValue, Version version)
      Checks whether an enum constant should be serialized for the target version by inspecting the VersionFilter annotation on the enum constant's field.
      Parameters:
      enumValue - the enum constant to check
      version - 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 a VersionFilter above the target version.
    • filterHashesByVersion

      public static List<Hash> filterHashesByVersion(List<Hash> hashes, Version version)
      Filters a list of Hashes, removing entries whose Algorithm has a VersionFilter above the target version.
    • 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