XStream
  1. XStream
  2. XSTR-309

More Versatile Boolean conversion options

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.1
    • Component/s: None
    • Labels:
      None

      Description

      This patch adds new boolean conversion options that can be easily enabled via code like this:

      class Perms {
      boolean readable = true;
      boolean writable = false;
      }

      xstream.registerConverter(BooleanConverter.TRUE_FALSE); // the default, same as before

      <perms>
        <readable>true</readable>
        <writable>false</writable>
      </perms>
      

      xstream.registerConverter(BooleanConverter.YES_NO);

      <perms>
        <readable>yes</readable>
        <writable>no</writable>
      </perms>
      

      xstream.registerConverter(BooleanConverter.BINARY);

      <perms>
        <readable>1</readable>
        <writable>0</writable>
      </perms>
      

      xstream.registerConverter(BooleanConverter.EMPTY_ELEMENT);

      <perms>
        <readable/>
      </perms>
      

      Note that the EMPTY_ELEMENT BooleanConverter requires the XSTR-308 (http://jira.codehaus.org/browse/XSTR-308) patch that allows a converter to say weather or not a tag should be written for the value.

        Activity

        Hide
        Jörg Schaible added a comment -

        David, I have committed now a version that omits the ConditionalConverter part, but at least the other stuff is working. Thanks for the patch!

        Show
        Jörg Schaible added a comment - David, I have committed now a version that omits the ConditionalConverter part, but at least the other stuff is working. Thanks for the patch!
        Hide
        Jörg Schaible added a comment -

        Closed as fixed for 1.2.1

        Show
        Jörg Schaible added a comment - Closed as fixed for 1.2.1

          People

          • Assignee:
            Unassigned
            Reporter:
            David Blevins
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: