MCPcopy Index your code
hub / github.com/bazelbuild/bazel / noneableCast

Method noneableCast

src/main/java/net/starlark/java/eval/Dict.java:687–690  ·  view source on GitHub ↗

Like #cast, but if x is None, returns an empty Dict.

(
      Object x, Class<K> keyType, Class<V> valueType, String what)

Source from the content-addressed store, hash-verified

685
686 /** Like {@link #cast}, but if x is None, returns an empty Dict. */
687 public static <K, V> Dict<K, V> noneableCast(
688 Object x, Class<K> keyType, Class<V> valueType, String what) throws EvalException {
689 return x == Starlark.NONE ? empty() : cast(x, keyType, valueType, what);
690 }
691
692 @Override
693 public Object getIndex(StarlarkSemantics semantics, Object key) throws EvalException {

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.95
castMethod · 0.95

Tested by

no test coverage detected