Class ParseStruct

java.lang.Object
com.cognite.client.util.ParseStruct

public class ParseStruct extends Object
This class hosts methods to help parse data from Struct objects. Struct is used to represent data in CDF Raw as well as the typed version of Json objects.
  • Constructor Details

    • ParseStruct

      public ParseStruct()
  • Method Details

    • parseStringDelimited

      public static String parseStringDelimited(com.google.protobuf.Struct struct, String path, String delimiter)
      Parses a node in the Struct into a delimited string. This is convenient in case the node itself, or one of its parents, is a list with multiple entries.
      Parameters:
      struct - The Struct to parse.
      path - The path of node to parse, separated by period ("."). Ex: "parent.child.grandChild"
      delimiter - The delimiter to use in the resulting String
      Returns:
      A delimited string representation of parsed Struct
    • parseStringList

      public static List<String> parseStringList(com.google.protobuf.Struct struct, List<String> path)
      Parses a node in the Struct into a List<String>. This is convenient in case the node itself, or one of its parents, is a list.
      Parameters:
      struct - The Struct to parse.
      path - The path of node to parse, each item in the list is a path component.
      Returns:
      A list of the data matching the path. If no match, then an empty list is returned.
    • parseStringList

      public static List<String> parseStringList(com.google.protobuf.Value value, List<String> path)
      Parses a node in the Value into a List<String>. This is convenient in case the node itself, or one of its parents, is a list.
      Parameters:
      value - The Value to parse
      path - The path of node to parse, each item in the list is a path component.
      Returns:
      A list of the data matching the path. If no match, then an empty list is returned.
      See Also: