@Test void credential() { assertEquals(singletonMap("tcomp::ui::credential", "true"), enricher.onParameterAnnotation("testParam", String.class, new Credential() { @Override public Class<? extends Annotation> annotationType() { return Credential.class; } })); }
@Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Ui condition = annotation.annotationType().getAnnotation(Ui.class); if (condition != null) { final String prefix = META_PREFIX + annotation.annotationType().getSimpleName().toLowerCase(ENGLISH) + "::"; if (GridLayouts.class == annotation.annotationType()) { return Stream .of(GridLayouts.class.cast(annotation).value()) .flatMap(a -> toConfig(a, prefix.substring(0, prefix.length() - 3) + "::").entrySet().stream()) .collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); } if (DateTime.class == annotation.annotationType()) { final String key = META_PREFIX + "datetime"; if (parameterType == LocalTime.class) { return singletonMap(key, "time"); } if (parameterType == LocalDate.class) { return singletonMap(key, "date"); } if (parameterType == LocalDateTime.class) { return singletonMap(key, "datetime"); } if (parameterType == ZonedDateTime.class || parameterType == Object.class ) { return singletonMap(key, "zoneddatetime"); } throw new IllegalArgumentException( "Unsupported type for @DateTime option: " + parameterType + " on " + parameterName); } return toConfig(annotation, prefix); } return emptyMap(); }
UiParameterEnricher extends BaseParameterEnricher { @Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Ui condition = annotation.annotationType().getAnnotation(Ui.class); if (condition != null) { final String prefix = META_PREFIX + annotation.annotationType().getSimpleName().toLowerCase(ENGLISH) + "::"; if (GridLayouts.class == annotation.annotationType()) { return Stream .of(GridLayouts.class.cast(annotation).value()) .flatMap(a -> toConfig(a, prefix.substring(0, prefix.length() - 3) + "::").entrySet().stream()) .collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); } if (DateTime.class == annotation.annotationType()) { final String key = META_PREFIX + "datetime"; if (parameterType == LocalTime.class) { return singletonMap(key, "time"); } if (parameterType == LocalDate.class) { return singletonMap(key, "date"); } if (parameterType == LocalDateTime.class) { return singletonMap(key, "datetime"); } if (parameterType == ZonedDateTime.class || parameterType == Object.class ) { return singletonMap(key, "zoneddatetime"); } throw new IllegalArgumentException( "Unsupported type for @DateTime option: " + parameterType + " on " + parameterName); } return toConfig(annotation, prefix); } return emptyMap(); } }
UiParameterEnricher extends BaseParameterEnricher { @Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Ui condition = annotation.annotationType().getAnnotation(Ui.class); if (condition != null) { final String prefix = META_PREFIX + annotation.annotationType().getSimpleName().toLowerCase(ENGLISH) + "::"; if (GridLayouts.class == annotation.annotationType()) { return Stream .of(GridLayouts.class.cast(annotation).value()) .flatMap(a -> toConfig(a, prefix.substring(0, prefix.length() - 3) + "::").entrySet().stream()) .collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); } if (DateTime.class == annotation.annotationType()) { final String key = META_PREFIX + "datetime"; if (parameterType == LocalTime.class) { return singletonMap(key, "time"); } if (parameterType == LocalDate.class) { return singletonMap(key, "date"); } if (parameterType == LocalDateTime.class) { return singletonMap(key, "datetime"); } if (parameterType == ZonedDateTime.class || parameterType == Object.class ) { return singletonMap(key, "zoneddatetime"); } throw new IllegalArgumentException( "Unsupported type for @DateTime option: " + parameterType + " on " + parameterName); } return toConfig(annotation, prefix); } return emptyMap(); }  }
UiParameterEnricher extends BaseParameterEnricher { @Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Ui condition = annotation.annotationType().getAnnotation(Ui.class); if (condition != null) { final String prefix = META_PREFIX + annotation.annotationType().getSimpleName().toLowerCase(ENGLISH) + "::"; if (GridLayouts.class == annotation.annotationType()) { return Stream .of(GridLayouts.class.cast(annotation).value()) .flatMap(a -> toConfig(a, prefix.substring(0, prefix.length() - 3) + "::").entrySet().stream()) .collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); } if (DateTime.class == annotation.annotationType()) { final String key = META_PREFIX + "datetime"; if (parameterType == LocalTime.class) { return singletonMap(key, "time"); } if (parameterType == LocalDate.class) { return singletonMap(key, "date"); } if (parameterType == LocalDateTime.class) { return singletonMap(key, "datetime"); } if (parameterType == ZonedDateTime.class || parameterType == Object.class ) { return singletonMap(key, "zoneddatetime"); } throw new IllegalArgumentException( "Unsupported type for @DateTime option: " + parameterType + " on " + parameterName); } return toConfig(annotation, prefix); } return emptyMap(); }  @Override Map<Type, Collection<Annotation>> getImplicitAnnotationForTypes(); @Override Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType,
            final Annotation annotation); }
UiParameterEnricher extends BaseParameterEnricher { @Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Ui condition = annotation.annotationType().getAnnotation(Ui.class); if (condition != null) { final String prefix = META_PREFIX + annotation.annotationType().getSimpleName().toLowerCase(ENGLISH) + "::"; if (GridLayouts.class == annotation.annotationType()) { return Stream .of(GridLayouts.class.cast(annotation).value()) .flatMap(a -> toConfig(a, prefix.substring(0, prefix.length() - 3) + "::").entrySet().stream()) .collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); } if (DateTime.class == annotation.annotationType()) { final String key = META_PREFIX + "datetime"; if (parameterType == LocalTime.class) { return singletonMap(key, "time"); } if (parameterType == LocalDate.class) { return singletonMap(key, "date"); } if (parameterType == LocalDateTime.class) { return singletonMap(key, "datetime"); } if (parameterType == ZonedDateTime.class || parameterType == Object.class ) { return singletonMap(key, "zoneddatetime"); } throw new IllegalArgumentException( "Unsupported type for @DateTime option: " + parameterType + " on " + parameterName); } return toConfig(annotation, prefix); } return emptyMap(); }  @Override Map<Type, Collection<Annotation>> getImplicitAnnotationForTypes(); @Override Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType,
            final Annotation annotation); static final String META_PREFIX; }