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 fromStruct
objects.Struct
is 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 String
parseStringDelimited(com.google.protobuf.Struct struct, String path, String delimiter)
Parses a node in theStruct
into a delimited string.static List<String>
parseStringList(com.google.protobuf.Struct struct, List<String> path)
Parses a node in theStruct
into aList<String>
.static List<String>
parseStringList(com.google.protobuf.Value value, List<String> path)
Parses a node in theValue
into aList<String>
.
-
-
-
Method Detail
-
parseStringDelimited
public static String parseStringDelimited(com.google.protobuf.Struct struct, String path, String delimiter)
Parses a node in theStruct
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 theStruct
into 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 theValue
into 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)
-
-