MCPcopy Create free account
hub / github.com/grpc/grpc-java / getBoolean

Method getBoolean

core/src/main/java/io/grpc/internal/JsonUtil.java:252–264  ·  view source on GitHub ↗

Gets a boolean from an object for the given key. If the key is not present, this returns null. If the value is not a Boolean, throws an exception.

(Map<String, ?> obj, String key)

Source from the content-addressed store, hash-verified

250 * If the value is not a Boolean, throws an exception.
251 */
252 @Nullable
253 public static Boolean getBoolean(Map<String, ?> obj, String key) {
254 assert key != null;
255 if (!obj.containsKey(key)) {
256 return null;
257 }
258 Object value = obj.get(key);
259 if (!(value instanceof Boolean)) {
260 throw new ClassCastException(
261 String.format("value '%s' for key '%s' in '%s' is not Boolean", value, key, obj));
262 }
263 return (Boolean) value;
264 }
265
266 /**
267 * Casts a list of unchecked JSON values to a list of checked objects in Java type.

Callers 7

convertMethod · 0.95
getLbPolicyConfigMethod · 0.95
parseJsonLogFilterMethod · 0.95
runServersMethod · 0.45

Calls 2

containsKeyMethod · 0.80
getMethod · 0.65

Tested by 1

runServersMethod · 0.36