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

        Jörg Schaible made changes -
        Field Original Value New Value
        Resolution Fixed [ 1 ]
        Fix Version/s 1.x Maintenance [ 12873 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Jörg Schaible made changes -
        Fix Version/s 1.x Maintenance [ 12873 ]
        Fix Version/s 1.2.1 [ 12872 ]
        Jörg Schaible made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: