Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-1926 Adding more commands to Forge and improve existing ones
  3. FORGE-1801

Being able to add a custom constraint annotation to a property

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Unresolved
    • Icon: Major Major
    • 3.x Future
    • 2.5.0.Final
    • Java EE
    • None

      With FORGE-1616 I can now create my own constraint. For example, this is the way I create an ISBN constraint :

      constraint-new-annotation --named ISBN
      

      The constraint is created, by default, under the constraint package. Now the problem, is that I can't apply it to a property because the constraint is not known. If I add a constraint, and press TAB for completion, ISBN does not appear :

      [Book.java]$ constraint-add --onProperty isbn --constraint TAB
      Valid  Null  NotNull  AssertTrue  AssertFalse  Min  Max  DecimalMin  DecimalMax  Size  Digits  Past  Future  Pattern
      

      Even if I try to add the location of the constraint, it does not work :

      [Book.java]$ constraint-add --onProperty isbn --constraint ../constraints/ISBN
      
      [0] - Valid
      [1] - Null
      [2] - NotNull
      [3] - AssertTrue
      [4] - AssertFalse
      [5] - Min
      [6] - Max
      [7] - DecimalMin
      [8] - DecimalMax
      [9] - Size
      [10] - Digits
      [11] - Past
      [12] - Future
      [13] - Pattern
      
      ***ERROR*** Constraint must be specified.
      

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

                Created:
                Updated: