Created
July 11, 2024 00:42
-
-
Save Konicai/3b64857a8e6260ed86b06194a58cfbf9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static AnnotatedType elementType(final AnnotatedType containerType) { | |
| if (!(containerType instanceof AnnotatedParameterizedType)) { | |
| throw new IllegalArgumentException("raw types unsupported"); | |
| } | |
| return ((AnnotatedParameterizedType) containerType).getAnnotatedActualTypeArguments()[0]; | |
| } | |
| private static Type listType(AnnotatedType elementType) { | |
| return TypeFactory.parameterizedClass(List.class, elementType.getType()); | |
| } | |
| private static Type mapType(AnnotatedType mapEntryType) { | |
| if (!(mapEntryType instanceof AnnotatedParameterizedType)) { | |
| throw new IllegalArgumentException("raw types unsupported"); | |
| } | |
| AnnotatedType[] parameters = ((AnnotatedParameterizedType) mapEntryType).getAnnotatedActualTypeArguments(); | |
| return TypeFactory.parameterizedClass(Map.class, parameters[0].getType(), parameters[1].getType()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment