Class ComplexDataTypeParser


  • public class ComplexDataTypeParser
    extends Object
    Utility class for parsing complex data type objects (map, array, struct).
    • Constructor Detail

      • ComplexDataTypeParser

        public ComplexDataTypeParser()
        Constructor class for ComplexDataTypeParser.
    • Method Detail

      • parse

        public com.fasterxml.jackson.databind.JsonNode parse​(String json)
        Parses a JSON string into a JsonNode.
        Parameters:
        json - the JSON string to parse
        Returns:
        the parsed JsonNode
      • parseToStruct

        public Map<String,​Object> parseToStruct​(com.fasterxml.jackson.databind.JsonNode node,
                                                      Map<String,​String> typeMap)
        Parses a JsonNode into a Struct representation using the provided type map.
        Parameters:
        node - the JsonNode to parse
        typeMap - the type map defining the structure of the Struct
        Returns:
        a Map representing the Struct
      • parseToArray

        public List<Object> parseToArray​(com.fasterxml.jackson.databind.JsonNode node,
                                         String elementType)
        Parses a JsonNode into an Array representation using the provided element type.
        Parameters:
        node - the JsonNode to parse
        elementType - the type of elements in the array
        Returns:
        a List representing the Array
      • parseToMap

        public Map<String,​Object> parseToMap​(String json,
                                                   String metadata)
        Parses a JSON string into a Map representation based on the provided metadata.
        Parameters:
        json - the JSON string to parse
        metadata - the metadata defining the structure of the Map
        Returns:
        a Map representing the parsed JSON