Tapestry 5
  1. Tapestry 5
  2. TAP5-149

Add JPA-annotation-driven validator

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.15
    • Fix Version/s: 5.3
    • Component/s: None
    • Labels:
      None

      Description

      The trend in validation seems to be to annotate your domain object properties; the annotations are then used by validation frameworks to validate the domain objects (see JPA / Hibernate Validator / JSR 303 / AppFuse 2 / etc).

      It'd be nice if Tapestry had a JpaValidator built in, which wouldn't be hard, except that the Validator interface doesn't provide enough information in the validate( ) method:

      public void validate(IFormComponent field, ValidationMessages messages, Object value) throws ValidatorException

      The options, as far as I can tell, would be:
      1. The Validator level is the wrong level at which to read the annotations; read them higher up and assign multiple low-level validators (maxLength,required,maxValue,etc) at runtime. But where?
      2. Provide the IBinding from which the value originated as an extra parameter in the validate( ) method, but let the validators check for whatever specific IBinding implementations they are interested in via instanceof.
      3. Provide the IBinding from which the value originated as an extra parameter in the validate( ) method, and also enhance IBinding so that there is some standard way to access this sort of extra info without worrying about the specific binding type.

      Thoughts?

        Activity

        Hide
        Christian Köberl added a comment -

        I think this can be closed now: Tapestry Beanvalidator is doing exactly this (http://tapestry.apache.org/tapestry5.2-dev/tapestry-beanvalidator/)

        Show
        Christian Köberl added a comment - I think this can be closed now: Tapestry Beanvalidator is doing exactly this ( http://tapestry.apache.org/tapestry5.2-dev/tapestry-beanvalidator/ )
        Hide
        Massimo Lusetti added a comment -

        There's the beanvalidator module

        Show
        Massimo Lusetti added a comment - There's the beanvalidator module

          People

          • Assignee:
            Unassigned
            Reporter:
            Daniel Gredler
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development