XStream
  1. XStream
  2. XSTR-716

Allow null value of for Boolean datatype

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Not A Bug
    • Affects Version/s: 1.4.2
    • Fix Version/s: 1.x Maintenance
    • Component/s: Converters
    • Labels:
      None

      Description

      <myInstrument>
      <myInstrumentId>20</paymentInstrumentId>
      <nickName>XYZ</nickName>
      <defaultInstrument/>
      </myInstrument>

      I have define the data type for defaultInstrument to be Boolean. And I expect this value to be null if nothing is passed in the request so that I don't end up updating the already stored default value of this instrument. I looked into the BooleanConvertor code.

      public Object fromString(final String str) {
      if (caseSensitive)

      { return positive.equals(str) ? Boolean.TRUE : Boolean.FALSE; }

      else

      { return positive.equalsIgnoreCase(str) ? Boolean.TRUE : Boolean.FALSE; }

      }

      There is no check if its primitive type or an Object and to take a decision that value can be null for the object. Is there a way to handle this wo\ithout having to right a custom converter.

        People

        • Assignee:
          Jörg Schaible
          Reporter:
          Abhay Kumar
        • Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: