Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6179657

RFE: Classes should be able to provide PersistenceDelegates for their encoding

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • client-libs
    • x86
    • windows_xp

      A DESCRIPTION OF THE REQUEST :
      I propose adding a new interface with a meaning similar to Serializable. Any class implementing XMLEncodable would have to implement getPersistenceDelegate() and return a persistence delegate to encode itself.

      There would be three ways of encoding classes using XMLEncoder:

      1) Beans, they don't need a persistence delegate.
      2) Non-beans that do not implement XMLEncodable would have to associate a PersistenceDelegate with the XMLEncoder for the class
      3) Non-beans that implement XMLEncoder and provide getPersistenceDelegate().

      In all of the above cases, users can still override these delegates by calling XMLEncoder.setPersistenceDelegate() and providing a custom delegate.

      Methods 1 and 2 are currently supported by XMLEncoder. I am simply requesting we add method 3.

      JUSTIFICATION :
      Reduced overhead: As more and more non-bean core classes are supported under-the-hood by XMLEncoder for encoding, the internal Map of [Class, PersistenceDelegate] will grow. This new method will reduce the overhead of storing such a map.

      Increased ease-of-use: No need to associate PersistenceDelegates with classes that implement XMLEncodable. This would apply to 3rd-party classes, core classes, etc.

      Backwards compatibility is maintained
      ###@###.### 10/15/04 02:58 GMT

            malenkov Sergey Malenkov (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: