Groovy的;注释类型不能是内部

时间:2016-06-09 13:32:30

标签: groovy bean-validation

我创建了我的验证器接口,以使用以下代码验证两个bean属性是否匹配:

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE )
@Constraint(validatedBy = FieldMatchesValidator.class)
@Documented

 @interface FieldMatches {

    String fieldName();

    String dependFieldName();

    String message() default "{FieldMatches.message}";

    Class<?>[] groups() default [];

    Class<? extends Payload>[] payload() default [];


   @Retention(RetentionPolicy.RUNTIME)
   @Target(ElementType.TYPE )
   @Documented
    @interface List {
       FieldMatches[] value();
   }

}

在注释中,我期待的是:

 @FieldMatches.List([
        @FieldMatches(
                fieldName = "pass",
                dependFieldName = "confpass1"),
        @FieldMatches(
                fieldName = "pass",
                dependFieldName = "confpass1")
    ])

有了这个,我收到以下错误:

Annotation type cannot be inner

提前感谢您的帮助。

0 个答案:

没有答案