javaserverfaces-spec-public
  1. javaserverfaces-spec-public
  2. JAVASERVERFACES_SPEC_PUBLIC-596

@FacesConverter annotation cannot set both converter-id and converter-for-class

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.2
    • Component/s: Validation/Conversion
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      596
    • Status Whiteboard:
      Hide

      cat2 vdldoc size_small importance_medium

      Show
      cat2 vdldoc size_small importance_medium

      Description

      In a configuration file, you can specify BOTH a converter-id and
      converter-for-class for a given converter class, for example

      <converter>
      <converter-id>com.corejsf.CreditCardId</converter-id>
      <converter-class>com.corejsf.CreditCardConverter</converter-class>
      </converter>

      <converter>
      <converter-for-class>com.corejsf.CreditCard</converter-for-class>
      <converter-class>com.corejsf.CreditCardConverter</converter-class>
      </converter>

      Trying to achieve the same effect with the @FacesConverter annotation does not work:

      @FacesConverter(value="com.corejsf.CreditCardId", forClass=CreditCard.class)
      public class CreditCardConverter...

      The javadoc for FacesConverter accurately tell that only
      Application.addConverter(java.lang.String,java.lang.String) is invoked in this
      case. But this is not desirable. There is no reason not to call
      Application.addConverter(java.lang.Class,java.lang.String) in addition to the
      first call--they have entirely different purposes.

      In particular, this makes it impossible to implement a custom converter tag that
      is also an automatic converter with just using annotations.

      The behavior ought to be changed to "The implementation must guarantee that for
      each class annotated with FacesConverter, found with the algorithm in section
      JSF.11.5, the proper variants of Application.addConverter() are called. If
      converter-id is not the empty string,
      Application.addConverter(java.lang.String,java.lang.String) is called, passing
      the derived converter-id as the first argument and the derived converter-class
      as the second argument. If forClass is not java.lang.Object.class,
      Application.addConverter(java.lang.Class,java.lang.String) is called, passing
      the converter-for-class as the first argument and the derived converter-class as
      the second argument. The implementation must guarantee that all such calls to
      addConverter() happen during application startup time and before any requests
      are serviced."

        Activity

        Hide
        Ed Burns added a comment -

        triage

        Show
        Ed Burns added a comment - triage
        Hide
        Ed Burns added a comment -

        sheetalv

        Show
        Ed Burns added a comment - sheetalv
        Hide
        rogerk added a comment -

        triage

        Show
        rogerk added a comment - triage
        Hide
        Ed Burns added a comment -

        Bulk assign all of Sheetal's spec issues to me.

        Show
        Ed Burns added a comment - Bulk assign all of Sheetal's spec issues to me.
        Hide
        Manfred Riem added a comment -

        Closing resolved issue out

        Show
        Manfred Riem added a comment - Closing resolved issue out

          People

          • Assignee:
            Unassigned
            Reporter:
            cayhorstmann
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: