Get the value for a custom option or its inherent default. @param key Key identifying option
(Key<T> key)
| 429 | * @param key Key identifying option |
| 430 | */ |
| 431 | @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1869") |
| 432 | @SuppressWarnings("unchecked") |
| 433 | public <T> T getOption(Key<T> key) { |
| 434 | Preconditions.checkNotNull(key, "key"); |
| 435 | for (int i = 0; i < customOptions.length; i++) { |
| 436 | if (key.equals(customOptions[i][0])) { |
| 437 | return (T) customOptions[i][1]; |
| 438 | } |
| 439 | } |
| 440 | return key.defaultValue; |
| 441 | } |
| 442 | |
| 443 | /** |
| 444 | * Returns the executor override to use for this specific call, or {@code null} if there is no |