Package dev.voidframework.core.utils
Class YamlUtils
java.lang.Object
dev.voidframework.core.utils.YamlUtils
Utility to handle YAML document.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TfromYaml(byte[] yamlByteArray, com.fasterxml.jackson.databind.JavaType outputJavaType) Converts a YAML document into to a Java object.static <T> TConverts a YAML document into to a Java object.static <T> TfromYaml(com.fasterxml.jackson.databind.JsonNode yaml, com.fasterxml.jackson.databind.JavaType outputJavaType) Converts a YAML document into to a Java object.static <T> TConverts a YAML document into to a Java object.static <T> TfromYaml(InputStream inputStreamYaml, com.fasterxml.jackson.databind.JavaType outputJavaType) Converts a YAML document into to a Java object.static <T> TfromYaml(InputStream inputStreamYaml, Class<T> outputClassType) Converts a YAML document into to a Java object.static StringtoString(com.fasterxml.jackson.databind.JsonNode yaml) Converts an YAML to string.static StringConverts an object to YAML document.static com.fasterxml.jackson.databind.JsonNodetoYaml(byte[] data) Converts a byte array to a YAML document.static com.fasterxml.jackson.databind.JsonNodetoYaml(InputStream inputStreamYaml) Converts anInputStreamto a YAML document.
-
Method Details
-
toString
Converts an YAML to string.- Parameters:
yaml- The YAML to convert.- Returns:
- The string representation.
-
toString
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
Converts anInputStreamto a YAML document.- Parameters:
inputStreamYaml-InputStreamcontaining 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 convertoutputClassType- 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 convertoutputJavaType- Expected Java object type- Returns:
- The Java object
-
fromYaml
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 convertoutputClassType- Expected Java object type- Returns:
- The Java object
-
fromYaml
Converts a YAML document into to a Java object.- Type Parameters:
T- The type of the Java object- Parameters:
inputStreamYaml-InputStreamcontaining a YAML document to convertoutputClassType- 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 convertoutputJavaType- 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-InputStreamcontaining a YAML document to convertoutputJavaType- Expected Java object type- Returns:
- The Java object
-