If key's type is Set >, returns a key with type Set with the same qualifier. Otherwise returns Optional#empty().
(Key key, Class<?> wrappingClass)
| 419 | * <Bar>} with the same qualifier. Otherwise returns {@link Optional#empty()}. |
| 420 | */ |
| 421 | Optional<Key> unwrapSetKey(Key key, Class<?> wrappingClass) { |
| 422 | if (SetType.isSet(key)) { |
| 423 | SetType setType = SetType.from(key); |
| 424 | if (!setType.isRawType() && setType.elementsAreTypeOf(wrappingClass)) { |
| 425 | return Optional.of( |
| 426 | key.toBuilder().type(setOf(setType.unwrappedElementType(wrappingClass))).build()); |
| 427 | } |
| 428 | } |
| 429 | return Optional.empty(); |
| 430 | } |
| 431 | |
| 432 | /** |
| 433 | * If {@code key}'s type is {@code Optional<T>} for some {@code T}, returns a key with the same |
no test coverage detected