Class YamlUtils

java.lang.Object
dev.voidframework.core.utils.YamlUtils

public final class YamlUtils extends Object
Utility to handle YAML document.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> T
    fromYaml(byte[] yamlByteArray, com.fasterxml.jackson.databind.JavaType outputJavaType)
    Converts a YAML document into to a Java object.
    static <T> T
    fromYaml(byte[] yamlByteArray, Class<T> outputClassType)
    Converts a YAML document into to a Java object.
    static <T> T
    fromYaml(com.fasterxml.jackson.databind.JsonNode yaml, com.fasterxml.jackson.databind.JavaType outputJavaType)
    Converts a YAML document into to a Java object.
    static <T> T
    fromYaml(com.fasterxml.jackson.databind.JsonNode yaml, Class<T> outputClassType)
    Converts a YAML document into to a Java object.
    static <T> T
    fromYaml(InputStream inputStreamYaml, com.fasterxml.jackson.databind.JavaType outputJavaType)
    Converts a YAML document into to a Java object.
    static <T> T
    fromYaml(InputStream inputStreamYaml, Class<T> outputClassType)
    Converts a YAML document into to a Java object.
    static String
    toString(com.fasterxml.jackson.databind.JsonNode yaml)
    Converts an YAML to string.
    static String
    Converts an object to YAML document.
    static com.fasterxml.jackson.databind.JsonNode
    toYaml(byte[] data)
    Converts a byte array to a YAML document.
    static com.fasterxml.jackson.databind.JsonNode
    toYaml(InputStream inputStreamYaml)
    Converts an InputStream to a YAML document.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • toString

      public static String toString(com.fasterxml.jackson.databind.JsonNode yaml)
      Converts an YAML to string.
      Parameters:
      yaml - The YAML to convert.
      Returns:
      The string representation.
    • toString

      public static String toString(Object obj)
      Converts an object to YAML document.
      Parameters:
      obj - Object to convert in YAML
      Returns:
      The string representation
    • toYaml

      public static com.fasterxml.jackson.databind.JsonNode toYaml(byte[] data)
      Converts a byte array to a YAML document.
      Parameters:
      data - data to convert in YAML
      Returns:
      The YAML node
    • toYaml

      public static com.fasterxml.jackson.databind.JsonNode toYaml(InputStream inputStreamYaml)
      Converts an InputStream to a YAML document.
      Parameters:
      inputStreamYaml - InputStream containing data to convert in YAML
      Returns:
      The JSON node
    • fromYaml

      public static <T> T fromYaml(com.fasterxml.jackson.databind.JsonNode yaml, Class<T> outputClassType)
      Converts a YAML document into to a Java object.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      yaml - YAML document to convert
      outputClassType - Expected Java object type
      Returns:
      The Java object
    • fromYaml

      public static <T> T fromYaml(com.fasterxml.jackson.databind.JsonNode yaml, com.fasterxml.jackson.databind.JavaType outputJavaType)
      Converts a YAML document into to a Java object.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      yaml - YAML document to convert
      outputJavaType - Expected Java object type
      Returns:
      The Java object
    • fromYaml

      public static <T> T fromYaml(byte[] yamlByteArray, Class<T> outputClassType)
      Converts a YAML document into to a Java object.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      yamlByteArray - YAML document as bytes array to convert
      outputClassType - Expected Java object type
      Returns:
      The Java object
    • fromYaml

      public static <T> T fromYaml(InputStream inputStreamYaml, Class<T> outputClassType)
      Converts a YAML document into to a Java object.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      inputStreamYaml - InputStream containing a YAML document to convert
      outputClassType - Expected Java object type
      Returns:
      The Java object
    • fromYaml

      public static <T> T fromYaml(byte[] yamlByteArray, com.fasterxml.jackson.databind.JavaType outputJavaType)
      Converts a YAML document into to a Java object.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      yamlByteArray - YAML document as bytes array to convert
      outputJavaType - Expected Java object type
      Returns:
      The Java object
    • fromYaml

      public static <T> T fromYaml(InputStream inputStreamYaml, com.fasterxml.jackson.databind.JavaType outputJavaType)
      Converts a YAML document into to a Java object.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      inputStreamYaml - InputStream containing a YAML document to convert
      outputJavaType - Expected Java object type
      Returns:
      The Java object