Class JsonYamlUtil


  • public class JsonYamlUtil
    extends Object
    Author:
    Madhav Krishna
    • Method Detail

      • readNoException

        public static <T> T readNoException​(String path,
                                            Class<T> type,
                                            com.jayway.jsonpath.DocumentContext yamlDocCtx)
      • readNoException

        public static <T> T readNoException​(String path,
                                            com.jayway.jsonpath.TypeRef<T> type,
                                            com.jayway.jsonpath.DocumentContext yamlDocCtx)
      • readNoException

        public static <T> T readNoException​(String yamlPath,
                                            Class<T> clazz,
                                            com.jayway.jsonpath.DocumentContext defaultProperties,
                                            com.jayway.jsonpath.DocumentContext overriddenProperties)
        This method first read the overridden property if that does not exist in overridenProperties then read it from defaultProperties.
        Type Parameters:
        T -
        Parameters:
        yamlPath -
        clazz -
        defaultProperties -
        overriddenProperties -
        Returns:
      • readNoException

        public static <T> T readNoException​(String yamlPath,
                                            com.jayway.jsonpath.TypeRef<T> typeRef,
                                            com.jayway.jsonpath.DocumentContext defaultProperties,
                                            com.jayway.jsonpath.DocumentContext overriddenProperties)
        This method first read the overridden property if that does not exist in overridenProperties then read it from defaultProperties.
        Type Parameters:
        T -
        Parameters:
        yamlPath -
        typeRef -
        defaultProperties -
        overriddenProperties -
        Returns:
      • convertObjectToJsonString

        public static String convertObjectToJsonString​(Object obj)
                                                throws com.fasterxml.jackson.core.JsonProcessingException
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException
      • readJsonPath

        public static Object readJsonPath​(String jsonPath,
                                          ParamValueType valueType,
                                          com.jayway.jsonpath.DocumentContext jsonDocCtx)
        Read the values at JSON path in the given JSON document.
        Parameters:
        jsonPath - - path for which values to be read.
        valueType - - type of values at the specified JSON path. If value type is empty then it will read as String value.
        jsonDocCtx - - JSON document from where the value to be read.
        Returns:
        the values based on valueType.
      • parseParamPath

        public static ParamPath parseParamPath​(String paramPath)
      • parseExpectedInfo

        public static ExpectedInfo parseExpectedInfo​(String expectedInfo)
      • parseInputValue

        public static InputValue parseInputValue​(String inputValue)
      • parseMethodInfo

        public static MethodInfo parseMethodInfo​(String methodInfo)