Package com.cognite.client.util
Class ParseStruct
- java.lang.Object
-
- com.cognite.client.util.ParseStruct
-
public class ParseStruct extends Object
This class hosts methods to help parse data fromStructobjects.Structis used to represent data in CDF Raw as well as the typed version of Json objects.
-
-
Constructor Summary
Constructors Constructor Description ParseStruct()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringparseStringDelimited(com.google.protobuf.Struct struct, String path, String delimiter)Parses a node in theStructinto aList<String>.static List<String>parseStringList(com.google.protobuf.Struct struct, List<String> path)Parses a node in theStructinto aList<String>.static List<String>parseStringList(com.google.protobuf.Value value, List<String> path)Parses a node in theValueinto aList<String>.
-
-
-
Method Detail
-
parseStringDelimited
public static String parseStringDelimited(com.google.protobuf.Struct struct, String path, String delimiter)
Parses a node in theStructinto aList<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, 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 theStructinto aList<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 theValueinto aList<String>. This is convenient in case the node itself, or one of its parents, is a list.- Parameters:
value- The Value to parsepath- 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:
parseStringList(Struct, List)
-
-