Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 4.1.0.Final
    • Fix Version/s: None
    • Component/s: engine
    • Last commented by a user?:
      true
    • Sprint:

      Description

      Current hibernate validator's ScriptAssert can only be defined on the Class level, not property level.

      In OVal,it can define the ScriptAssert at the property level,eg:

      public class BusinessObject 
      {
        @NotNull
        public String deliveryAddress;
      
        @NotNull public String invoiceAddress;
      
        // mailingAddress must either be the delivery address or the invoice address 
        @Assert(expr = "_value ==_this.deliveryAddress || _value == _this.invoiceAddress", lang = "groovy")
        public String mailingAddress;
      }
      

      With property level,we can get following benefit:

      1. Can be used in single property validation, It's very useful in UI layer validation
      2. The validation rule is close to the property definition, it's easy to manage

      In JSR303 spec, the ValueContext is not passed to the Contraint Validator as a parameter,
      so the validator can't get the "Current Bean" of the current property to be validated.

      The validation engine need to do some special work to support this feature.
      OVal can do this, so it won't be a problem for hibernate validator.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: