Wicket
  1. Wicket
  2. WICKET-3857

Allow validators access to component's model

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4.18, 1.5-RC6
    • Component/s: None
    • Labels:
      None

      Description

      sometimes it is useful for validators to get access to component's model. for example
      a) validators can use the model to get value as it was before editing started - ie a password validator that forces the user to change their password
      b) validators can access some metadata about the model - ie a model that implements IPropertyReflectionAwareModel

      in 1.4 this is done by adding a IModelAwareValidatable#getModel() mixin and casting IValidatable down to it. in 1.5 #getModel() has been introduced direction to IValidatable

        Activity

        Hide
        Martijn Dashorst added a comment -

        Reinstated Validatable in 1.5

        Show
        Martijn Dashorst added a comment - Reinstated Validatable in 1.5
        Hide
        Martijn Dashorst added a comment - - edited

        Removing Validatable from wicket core proper is IMO a mistake: the documentation specifically states that it is a user-space object, there is no issue with having it remain in core (is it obsolete?) and we really should make efforts of deprecating classes between major releases before removing them (unless there is no alternative i.e. where the deprecated class would not work).

        And removing it during RC phase is especially annoying as we strive to treat RCs as final releases.

        Unless Igor has specific issue with the class remaining in core, I would like it to be moved back (and am willing to do the work)

        Show
        Martijn Dashorst added a comment - - edited Removing Validatable from wicket core proper is IMO a mistake: the documentation specifically states that it is a user-space object, there is no issue with having it remain in core (is it obsolete?) and we really should make efforts of deprecating classes between major releases before removing them (unless there is no alternative i.e. where the deprecated class would not work). And removing it during RC phase is especially annoying as we strive to treat RCs as final releases. Unless Igor has specific issue with the class remaining in core, I would like it to be moved back (and am willing to do the work)
        Hide
        Igor Vaynberg added a comment -

        Validatable was there to facilitate using wicket validators outside of wicket or testing them stand-alone. its a trivial class to implement if you still need it...

        1.4->1.5 is a major release. we can break api between major releases, so its not necessary to keep it as deprecated.

        Show
        Igor Vaynberg added a comment - Validatable was there to facilitate using wicket validators outside of wicket or testing them stand-alone. its a trivial class to implement if you still need it... 1.4->1.5 is a major release. we can break api between major releases, so its not necessary to keep it as deprecated.
        Hide
        Martin Grigorov added a comment -

        reopening for discussion before releasing RC6

        Show
        Martin Grigorov added a comment - reopening for discussion before releasing RC6
        Hide
        Emond Papegaaij added a comment -

        With this issue, org.apache.wicket.validation.Validatable has been moved to a test package, making it unavailable in the maven artifacts. Validatable was part of Wicket's public API and not marked as deprecated, therefore I think it should stay available. Also, the implementation in the test packages has a bug in getModel: it always returns null, rather than the model.

        Show
        Emond Papegaaij added a comment - With this issue, org.apache.wicket.validation.Validatable has been moved to a test package, making it unavailable in the maven artifacts. Validatable was part of Wicket's public API and not marked as deprecated, therefore I think it should stay available. Also, the implementation in the test packages has a bug in getModel: it always returns null, rather than the model.

          People

          • Assignee:
            Igor Vaynberg
            Reporter:
            Igor Vaynberg
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development