Package com.cognite.client.util
Class ParseStruct
java.lang.Object
com.cognite.client.util.ParseStruct
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringparseStringDelimited(com.google.protobuf.Struct struct, String path, String delimiter) Parses a node in theStructinto a delimited string.parseStringList(com.google.protobuf.Struct struct, List<String> path) Parses a node in theStructinto aList<String>.parseStringList(com.google.protobuf.Value value, List<String> path) Parses a node in theValueinto aList<String>.
-
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 theStructinto 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
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
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:
-