@Test void conditionListValues() { assertEquals(new HashMap<String, String>() { { put("tcomp::condition::if::target", "foo.bar"); put("tcomp::condition::if::value", "true,false"); put("tcomp::condition::if::negate", "false"); put("tcomp::condition::if::evaluationStrategy", "DEFAULT"); } }, new ConditionParameterEnricher().onParameterAnnotation("testParam", String.class, new ActiveIf() { @Override public EvaluationStrategyOption[] evaluationStrategyOptions() { return new EvaluationStrategyOption[0]; } @Override public String target() { return "foo.bar"; } @Override public String[] value() { return new String[] { "true", "false" }; } @Override public boolean negate() { return false; } @Override public EvaluationStrategy evaluationStrategy() { return EvaluationStrategy.DEFAULT; } @Override public Class<? extends Annotation> annotationType() { return ActiveIf.class; } })); }
@Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Condition condition = annotation.annotationType().getAnnotation(Condition.class); if (condition != null) { final String type = condition.value(); if (ActiveIfs.class.isInstance(annotation)) { final ActiveIfs activeIfs = ActiveIfs.class.cast(annotation); final Map<String, String> metas = Stream .of(activeIfs.value()) .map(ai -> onParameterAnnotation(parameterName, parameterType, ai)) .collect(HashMap::new, (map, entry) -> { final String suffix = "::" + (map.size() / 4); map .putAll(entry .entrySet() .stream() .collect(toMap(e -> e.getKey() + suffix, Map.Entry::getValue))); }, HashMap::putAll); metas.putAll(toMeta(annotation, type, m -> !"value".equals(m.getName()))); return metas; } return toMeta(annotation, type, m -> true); } return emptyMap(); }
ConditionParameterEnricher extends BaseParameterEnricher { @Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Condition condition = annotation.annotationType().getAnnotation(Condition.class); if (condition != null) { final String type = condition.value(); if (ActiveIfs.class.isInstance(annotation)) { final ActiveIfs activeIfs = ActiveIfs.class.cast(annotation); final Map<String, String> metas = Stream .of(activeIfs.value()) .map(ai -> onParameterAnnotation(parameterName, parameterType, ai)) .collect(HashMap::new, (map, entry) -> { final String suffix = "::" + (map.size() / 4); map .putAll(entry .entrySet() .stream() .collect(toMap(e -> e.getKey() + suffix, Map.Entry::getValue))); }, HashMap::putAll); metas.putAll(toMeta(annotation, type, m -> !"value".equals(m.getName()))); return metas; } return toMeta(annotation, type, m -> true); } return emptyMap(); } }
ConditionParameterEnricher extends BaseParameterEnricher { @Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Condition condition = annotation.annotationType().getAnnotation(Condition.class); if (condition != null) { final String type = condition.value(); if (ActiveIfs.class.isInstance(annotation)) { final ActiveIfs activeIfs = ActiveIfs.class.cast(annotation); final Map<String, String> metas = Stream .of(activeIfs.value()) .map(ai -> onParameterAnnotation(parameterName, parameterType, ai)) .collect(HashMap::new, (map, entry) -> { final String suffix = "::" + (map.size() / 4); map .putAll(entry .entrySet() .stream() .collect(toMap(e -> e.getKey() + suffix, Map.Entry::getValue))); }, HashMap::putAll); metas.putAll(toMeta(annotation, type, m -> !"value".equals(m.getName()))); return metas; } return toMeta(annotation, type, m -> true); } return emptyMap(); }  }
ConditionParameterEnricher extends BaseParameterEnricher { @Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Condition condition = annotation.annotationType().getAnnotation(Condition.class); if (condition != null) { final String type = condition.value(); if (ActiveIfs.class.isInstance(annotation)) { final ActiveIfs activeIfs = ActiveIfs.class.cast(annotation); final Map<String, String> metas = Stream .of(activeIfs.value()) .map(ai -> onParameterAnnotation(parameterName, parameterType, ai)) .collect(HashMap::new, (map, entry) -> { final String suffix = "::" + (map.size() / 4); map .putAll(entry .entrySet() .stream() .collect(toMap(e -> e.getKey() + suffix, Map.Entry::getValue))); }, HashMap::putAll); metas.putAll(toMeta(annotation, type, m -> !"value".equals(m.getName()))); return metas; } return toMeta(annotation, type, m -> true); } return emptyMap(); }  @Override Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType,
            final Annotation annotation); }
ConditionParameterEnricher extends BaseParameterEnricher { @Override public Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType, final Annotation annotation) { final Condition condition = annotation.annotationType().getAnnotation(Condition.class); if (condition != null) { final String type = condition.value(); if (ActiveIfs.class.isInstance(annotation)) { final ActiveIfs activeIfs = ActiveIfs.class.cast(annotation); final Map<String, String> metas = Stream .of(activeIfs.value()) .map(ai -> onParameterAnnotation(parameterName, parameterType, ai)) .collect(HashMap::new, (map, entry) -> { final String suffix = "::" + (map.size() / 4); map .putAll(entry .entrySet() .stream() .collect(toMap(e -> e.getKey() + suffix, Map.Entry::getValue))); }, HashMap::putAll); metas.putAll(toMeta(annotation, type, m -> !"value".equals(m.getName()))); return metas; } return toMeta(annotation, type, m -> true); } return emptyMap(); }  @Override Map<String, String> onParameterAnnotation(final String parameterName, final Type parameterType,
            final Annotation annotation);  }