@Test void unique() { assertEquals(singletonMap("tcomp::validation::uniqueItems", "true"), enricher.onParameterAnnotation("testParam", Collection.class, new Uniques() { @Override public Class<? extends Annotation> annotationType() { return Uniques.class; } })); }
@Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Class<?> asClass = toClass(parameterType); return ofNullable(annotation.annotationType().getAnnotation(Validations.class)) .map(v -> Stream.of(v.value())) .orElseGet(() -> ofNullable(annotation.annotationType().getAnnotation(Validation.class)) .map(Stream::of) .orElseGet(Stream::empty)) .filter(v -> Stream.of(v.expectedTypes()).anyMatch(t -> asClass != null && t.isAssignableFrom(asClass))) .findFirst() .map(v -> singletonMap(META_PREFIX + v.name(), getValueString(annotation))) .orElseGet(Collections::emptyMap); }
ValidationParameterEnricher extends BaseParameterEnricher { @Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Class<?> asClass = toClass(parameterType); return ofNullable(annotation.annotationType().getAnnotation(Validations.class)) .map(v -> Stream.of(v.value())) .orElseGet(() -> ofNullable(annotation.annotationType().getAnnotation(Validation.class)) .map(Stream::of) .orElseGet(Stream::empty)) .filter(v -> Stream.of(v.expectedTypes()).anyMatch(t -> asClass != null && t.isAssignableFrom(asClass))) .findFirst() .map(v -> singletonMap(META_PREFIX + v.name(), getValueString(annotation))) .orElseGet(Collections::emptyMap); } }
ValidationParameterEnricher extends BaseParameterEnricher { @Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Class<?> asClass = toClass(parameterType); return ofNullable(annotation.annotationType().getAnnotation(Validations.class)) .map(v -> Stream.of(v.value())) .orElseGet(() -> ofNullable(annotation.annotationType().getAnnotation(Validation.class)) .map(Stream::of) .orElseGet(Stream::empty)) .filter(v -> Stream.of(v.expectedTypes()).anyMatch(t -> asClass != null && t.isAssignableFrom(asClass))) .findFirst() .map(v -> singletonMap(META_PREFIX + v.name(), getValueString(annotation))) .orElseGet(Collections::emptyMap); }  }
ValidationParameterEnricher extends BaseParameterEnricher { @Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Class<?> asClass = toClass(parameterType); return ofNullable(annotation.annotationType().getAnnotation(Validations.class)) .map(v -> Stream.of(v.value())) .orElseGet(() -> ofNullable(annotation.annotationType().getAnnotation(Validation.class)) .map(Stream::of) .orElseGet(Stream::empty)) .filter(v -> Stream.of(v.expectedTypes()).anyMatch(t -> asClass != null && t.isAssignableFrom(asClass))) .findFirst() .map(v -> singletonMap(META_PREFIX + v.name(), getValueString(annotation))) .orElseGet(Collections::emptyMap); }  @Override Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType,
            final Annotation annotation); }
ValidationParameterEnricher extends BaseParameterEnricher { @Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Class<?> asClass = toClass(parameterType); return ofNullable(annotation.annotationType().getAnnotation(Validations.class)) .map(v -> Stream.of(v.value())) .orElseGet(() -> ofNullable(annotation.annotationType().getAnnotation(Validation.class)) .map(Stream::of) .orElseGet(Stream::empty)) .filter(v -> Stream.of(v.expectedTypes()).anyMatch(t -> asClass != null && t.isAssignableFrom(asClass))) .findFirst() .map(v -> singletonMap(META_PREFIX + v.name(), getValueString(annotation))) .orElseGet(Collections::emptyMap); }  @Override Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType,
            final Annotation annotation); static final String META_PREFIX; }