io.infinicast.JObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of infinicast-client Show documentation
Show all versions of infinicast-client Show documentation
Infinicast SDK to communicate with the cloud.
package io.infinicast;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class JObject extends JToken {
public JObject() {
super();
}
public JObject(JObject rhs) {
this(rhs.node);
}
JObject(JsonNode node) {
super(node);
}
public static JObject Parse(String rhs) {
ObjectNode node = JsonHelpers.parse(rhs);
return new JObject(node);
}
public boolean containsKey(String key) {
return node.get(key) != null;
}
public Collection getKeys() {
Iterator stringIterator = node.fieldNames();
Set col = new HashSet<>();
while (stringIterator.hasNext()) {
col.add(stringIterator.next());
}
return col;
}
}