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

Method checkStringList

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

Casts a list of unchecked JSON values to a list of String. If the given list contains a value that is not a String, throws an exception.

(List<?> rawList)

Source from the content-addressed store, hash-verified

284 * contains a value that is not a String, throws an exception.
285 */
286 @SuppressWarnings("unchecked")
287 public static List<String> checkStringList(List<?> rawList) {
288 for (int i = 0; i < rawList.size(); i++) {
289 if (!(rawList.get(i) instanceof String)) {
290 throw new ClassCastException(
291 String.format(
292 Locale.US,
293 "value '%s' for idx %d in '%s' is not string", rawList.get(i), i, rawList));
294 }
295 }
296 return (List<String>) rawList;
297 }
298
299 private static final long DURATION_SECONDS_MIN = -315576000000L;
300 private static final long DURATION_SECONDS_MAX = 315576000000L;

Callers 1

getListOfStringsMethod · 0.95

Calls 2

sizeMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected