@Test void findDirectIcon() { assertFalse(finder.findDirectIcon(None.class).isPresent()); assertEquals("foo", finder.findDirectIcon(Direct.class).get()); }
public Optional<String> findDirectIcon(final AnnotatedElement type) { return ofNullable(type.getAnnotation(Icon.class)) .map(i -> i.value() == Icon.IconType.CUSTOM ? of(i.custom()).filter(s -> !s.isEmpty()).orElse("default") : i.value().getKey()); }
IconFinder { public Optional<String> findDirectIcon(final AnnotatedElement type) { return ofNullable(type.getAnnotation(Icon.class)) .map(i -> i.value() == Icon.IconType.CUSTOM ? of(i.custom()).filter(s -> !s.isEmpty()).orElse("default") : i.value().getKey()); } }
IconFinder { public Optional<String> findDirectIcon(final AnnotatedElement type) { return ofNullable(type.getAnnotation(Icon.class)) .map(i -> i.value() == Icon.IconType.CUSTOM ? of(i.custom()).filter(s -> !s.isEmpty()).orElse("default") : i.value().getKey()); }  }
IconFinder { public Optional<String> findDirectIcon(final AnnotatedElement type) { return ofNullable(type.getAnnotation(Icon.class)) .map(i -> i.value() == Icon.IconType.CUSTOM ? of(i.custom()).filter(s -> !s.isEmpty()).orElse("default") : i.value().getKey()); }  String findIcon(final AnnotatedElement type); Optional<String> findIndirectIcon(final AnnotatedElement type); Optional<String> findDirectIcon(final AnnotatedElement type); boolean isCustom(final Annotation icon); Annotation extractIcon(final AnnotatedElement annotatedElement); }
IconFinder { public Optional<String> findDirectIcon(final AnnotatedElement type) { return ofNullable(type.getAnnotation(Icon.class)) .map(i -> i.value() == Icon.IconType.CUSTOM ? of(i.custom()).filter(s -> !s.isEmpty()).orElse("default") : i.value().getKey()); }  String findIcon(final AnnotatedElement type); Optional<String> findIndirectIcon(final AnnotatedElement type); Optional<String> findDirectIcon(final AnnotatedElement type); boolean isCustom(final Annotation icon); Annotation extractIcon(final AnnotatedElement annotatedElement);  }