Class ObjectToYamlExtensions


  • public final class ObjectToYamlExtensions
    extends java.lang.Object
    The class ObjectToYamlExtensions converts java objects to yaml string objects
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.lang.String toYaml​(java.util.List<T> list)
      Creates from the given List a yaml string
      static <T> java.lang.String toYaml​(java.util.List<T> list, com.fasterxml.jackson.dataformat.yaml.YAMLMapper mapper)
      Creates from the given List a yaml string
      static <T> java.lang.String toYaml​(T object)
      Creates a yaml String from the given argument object
      static <T> java.lang.String toYaml​(T object, boolean newMapper)
      Creates a yaml String from the given Object
      static <T> java.lang.String toYaml​(T object, com.fasterxml.jackson.dataformat.yaml.YAMLMapper mapper)
      Creates a yaml String from the given Object and the given object mapper
      • Methods inherited from class java.lang.Object

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

      • toYaml

        public static <T> java.lang.String toYaml​(java.util.List<T> list)
                                           throws java.io.IOException
        Creates from the given List a yaml string
        Type Parameters:
        T - the generic type
        Parameters:
        list - the list
        Returns:
        the yaml string.
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • toYaml

        public static <T> java.lang.String toYaml​(java.util.List<T> list,
                                                  com.fasterxml.jackson.dataformat.yaml.YAMLMapper mapper)
                                           throws java.io.IOException
        Creates from the given List a yaml string
        Type Parameters:
        T - the generic type
        Parameters:
        list - the list
        mapper - the object mapper
        Returns:
        the yaml string
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred
      • toYaml

        public static <T> java.lang.String toYaml​(T object)
                                           throws com.fasterxml.jackson.core.JsonProcessingException
        Creates a yaml String from the given argument object
        Type Parameters:
        T - the generic type of the given argument object
        Parameters:
        object - the object.
        Returns:
        the json string.
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException - If an error occurs when converting object to String
      • toYaml

        public static <T> java.lang.String toYaml​(T object,
                                                  boolean newMapper)
                                           throws com.fasterxml.jackson.core.JsonProcessingException
        Creates a yaml String from the given Object
        Type Parameters:
        T - the generic type
        Parameters:
        object - the object
        newMapper - flag that indicates if a new ObjectMapper should be created. if true a new ObjectMapper will be created otherwise the ObjectMapper from this class will be returned.
        Returns:
        the string
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException - If an error occurs when converting object to String
      • toYaml

        public static <T> java.lang.String toYaml​(T object,
                                                  com.fasterxml.jackson.dataformat.yaml.YAMLMapper mapper)
                                           throws com.fasterxml.jackson.core.JsonProcessingException
        Creates a yaml String from the given Object and the given object mapper
        Type Parameters:
        T - the generic type
        Parameters:
        object - the object
        mapper - the object mapper
        Returns:
        the string
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException - If an error occurs when converting object to String