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

Method checkObjectList

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

Casts a list of unchecked JSON values to a list of checked objects in Java type. If the given list contains a value that is not a Map, throws an exception.

(List<?> rawList)

Source from the content-addressed store, hash-verified

268 * If the given list contains a value that is not a Map, throws an exception.
269 */
270 @SuppressWarnings("unchecked")
271 public static List<Map<String, ?>> checkObjectList(List<?> rawList) {
272 for (int i = 0; i < rawList.size(); i++) {
273 if (!(rawList.get(i) instanceof Map)) {
274 throw new ClassCastException(
275 String.format(
276 Locale.US, "value %s for idx %d in %s is not object", rawList.get(i), i, rawList));
277 }
278 }
279 return (List<Map<String, ?>>) rawList;
280 }
281
282 /**
283 * Casts a list of unchecked JSON values to a list of String. If the given list

Callers 9

convertMethod · 0.95
parseTxtResultsMethod · 0.95
getListOfObjectsMethod · 0.95
parseRpcEventsMethod · 0.95
getChannelCredentialsMethod · 0.95
parseServerInfosMethod · 0.95

Calls 2

sizeMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected