Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1568

contribution for wicket 1.5 generics (IConverter)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4-M1, 1.5-M3
    • 1.4-M2, 1.5-RC1
    • wicket
    • None

    Description

      I think it will be straightforward to let the converter of a component handle the same type <T> that the component itself uses

      ----------------------

      public class MyMoneyTextField extends TextField<BigDecimal>
      {
      public MyMoneyTextField(final String id, final IModel<BigDecimal> model)

      { super(id, model); }

      // ...

      @Override
      public IConverter<BigDecimal> getConverter(final Class<BigDecimal> type)
      {
      // no ugly casts here anymore
      //
      return new IConverter<BigDecimal>()
      {
      public BigDecimal convertToObject(final String value, final Locale locale)

      { // ... }

      public String convertToString(final BigDecimal value, final Locale locale)
      { // ... }

      };
      }
      }

      I attached a patch that implements this change and ask you to take a look at and integrate it if you consider it right and helpful.

      Best regards
      Peter

      Attachments

        1. converter.patch
          16 kB
          Peter Ertl
        2. WICKET-1568.patch
          41 kB
          Martin Tzvetanov Grigorov

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            pete Peter Ertl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: