Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-1615 Being able to create Bean Validation artifacts
  3. FORGE-1671

Add nested annotation to a constraint annotation

XMLWordPrintable

      At the moment a constraint annotation does not contain a List of constraints. So, at the moment, the command constraint-new-annotation generates the following code :

      @Documented
      @Constraint(validatedBy = {})
      @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
      @Retention(RUNTIME)
      @ReportAsSingleViolation
      public @interface URL {
      	String message() default "Invalid value";
      
      	Class<?>[] groups() default { };
      
      	Class<? extends Payload>[] payload() default { };
      

      It should add a nested annotation List of type array of constraint

      @Documented
      @Constraint(validatedBy = {})
      @Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
      @Retention(RUNTIME)
      @ReportAsSingleViolation
      public @interface URL {
      	String message() default "Invalid value";
      
      	Class<?>[] groups() default { };
      
      	Class<? extends Payload>[] payload() default { };
      
      	@Target( { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
      	@Retention(RUNTIME)
      	@Documented
      	public @interface List {
      		URL[] value();
      	}
      }
      

      See class : NewAnnotationCommand

              agoncal Antonio Goncalves (Inactive)
              agoncal Antonio Goncalves (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: