Returns the annotation value if mapKey's type is annotated with MapKey @MapKey(unwrapValue = true). @throws IllegalArgumentException if mapKey's type is not annotated with MapKey @MapKey at all.
(AnnotationMirror mapKey)
| 81 | * {@link MapKey @MapKey} at all. |
| 82 | */ |
| 83 | static Optional<? extends AnnotationValue> unwrapValue(AnnotationMirror mapKey) { |
| 84 | MapKey mapKeyAnnotation = mapKey.getAnnotationType().asElement().getAnnotation(MapKey.class); |
| 85 | checkArgument( |
| 86 | mapKeyAnnotation != null, "%s is not annotated with @MapKey", mapKey.getAnnotationType()); |
| 87 | return mapKeyAnnotation.unwrapValue() |
| 88 | ? Optional.of(getOnlyElement(getAnnotationValuesWithDefaults(mapKey).values())) |
| 89 | : Optional.empty(); |
| 90 | } |
| 91 | |
| 92 | static TypeMirror mapKeyType(AnnotationMirror mapKeyAnnotation, Types types) { |
| 93 | return unwrapValue(mapKeyAnnotation).isPresent() |
no test coverage detected