Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SuppressWarnings("unchecked")
- protected static <E extends Enum> Map<E, String[]> getTooltips(@NonNull Class<E> clazz) {
- return (Map<E, String[]>) tooltipCache.computeIfAbsent(clazz, c -> Arrays.stream(c.getDeclaredFields())
- .filter(Field::isEnumConstant)
- .map(field -> new Tuple<>(field, PReflection.getAnnotation(field, FormType.EnumMemberTooltip.class)))
- .filter(Tuple::isBNonNull)
- .collect(Collectors.toMap((EFunction<Tuple<Field, FormType.EnumMemberTooltip>, E>) t -> (E) t.getA().get(null), t -> Arrays.stream(t.getB().value())
- .filter(Objects::nonNull)
- .flatMap(line -> line.indexOf('\n') != -1 ? Arrays.stream(line.split("\n")) : Stream.of(line))
- .toArray(String[]::new))));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement