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

Command constraint-new-annotation to create a new constraint

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Done
    • Icon: Major Major
    • 2.2.0.Final
    • 2.1.1.Final
    • Java EE

      The following command will create a constraint annotation with no implementation, and a default error message :

      constraint-new-annotation --named URL
      

      This command first creates the constraint annotation (notice validatedBy = {})

      @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();
      	}
      }
      

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

              Created:
              Updated:
              Resolved: