Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2
    • Component/s: None
    • Labels:
      None

      Description

      — Suggested by Mark Helmstetter —

      A converter that provides functionality such
      that if an object has a method such as "public Object fromString(String str)". It
      seems that such a converter could be very valuable to avoid writing a special
      converter for lots of relatively simple objects that require special handling that
      the packaged converters don't address.

      — Additional notes by Joe —

      I think this is a good idea.

      An interface could be introduced for this that objects can implement if they want to be handled by the converter:

      package com.thoughtworks.xstream;

      public interface StringSerializable {
      String toString(); // implicit from Object anyway, but in the interface for clarity
      void fromString(String string);
      }

      Any objects implementing this method would also require a default constructor - similar to the contract of java.io.Externalizable.

      1. FromStringConverterPatch.patch
        291 kB
        Mark Helmstetter
      2. FromStringConverterPatch2.patch
        291 kB
        Mark Helmstetter
      3. patch.txt
        10 kB
        Guilherme Silveira
      4. patch.txt
        8 kB
        Guilherme Silveira

        People

        • Assignee:
          Unassigned
          Reporter:
          Joe Walnes
        • Votes:
          1 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: