Uploaded image for project: 'Spring Web Flow'
  1. Spring Web Flow
  2. SWF-924

Attach Converter to property path

    XMLWordPrintable

Details

    Description

      A propertyEditor can be attached to a certain property path of a bean, this allows for a very flexible conversion strategy. With the new conversionservice and converter implementations this is only possible in the flow definition and not with a programmatic approach like with the propertyEditorRegistrar.

      Example:

      User{
      @Mask(pattern = "ddd.ddd.dd")
      public String getBankAccountNumber();
      }

      In webflow 1.0 we had a PropertyEditorRegistrar that automatically add's a MaskPropertyEditor for each bean path with the Mask annotation. This made it possible to automatically render the properties with the correct mask and removed the masked when binding.

      In webflow 2 I could do it like this:

      <binder>
      <binding property="bankAccountNumber" converter="mask"/>
      </binder>

      But I would like to be able to configure this like the propertyEditorRegistrar so that I don't have to do this over and over again. I already defined the Mask in the source code so duplicating it in my flow definition is not very DRY.

      Is it clear what I am trying to say?

      Attachments

        Activity

          People

            kdonald Keith Donald
            eliwillaert eli willaert
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: