Pivot
  1. Pivot
  2. PIVOT-528

Allow Dictionary values to be specified using elements in WTKX

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.5.1
    • Component/s: wtk-wtkx
    • Labels:
      None

      Description

      Currently, it is possible to populate a dictionary type via attributes but not elements. For example, this is supported:

      <HashMap abc="123"/>

      as is this:

      <MyBeanClass>
      <abc>
      <MyOtherBeanClass/>
      </abc>
      </MyBeanClass>

      but this is not:

      <HashMap>
      <abc>
      <MyOtherBeanClass/>
      </abc>
      </HashMap>

      This prevents callers from populating a dictionary with anything other than primitive values. WTKXSerializer should also allow a caller to populate a dictionary with complex types, as shown above.

        Activity

        Hide
        Greg Brown added a comment -

        Good catch. That exception was no longer valid. This is now fixed.

        Show
        Greg Brown added a comment - Good catch. That exception was no longer valid. This is now fixed.
        Hide
        Appddevvv added a comment -

        Not sure its working that way for the userData property on a component.

        Here's the error I get from things like:

        Caused by: org.apache.pivot.serialization.SerializationException: Parent element must be a typed object.
        at org.apache.pivot.wtkx.WTKXSerializer.processStartElement(WTKXSerializer.java:643)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(WTKXSerializer.java:456)
        at org.apache.pivot.wtkx.WTKXSerializer.readObject(WTKXSerializer.java:412)
        at org.apache.pivot.springframework.SerializerFactoryBean.initSerializer(SerializerFactoryBean.java:146)
        ... 21 more

        Show
        Appddevvv added a comment - Not sure its working that way for the userData property on a component. Here's the error I get from things like: Caused by: org.apache.pivot.serialization.SerializationException: Parent element must be a typed object. at org.apache.pivot.wtkx.WTKXSerializer.processStartElement(WTKXSerializer.java:643) at org.apache.pivot.wtkx.WTKXSerializer.readObject(WTKXSerializer.java:456) at org.apache.pivot.wtkx.WTKXSerializer.readObject(WTKXSerializer.java:412) at org.apache.pivot.springframework.SerializerFactoryBean.initSerializer(SerializerFactoryBean.java:146) ... 21 more
        Hide
        Greg Brown added a comment -

        Yes. See the above example, which adds an instance of MyOtherBeanClass to a HashMap with a key of "abc".

        Show
        Greg Brown added a comment - Yes. See the above example, which adds an instance of MyOtherBeanClass to a HashMap with a key of "abc".
        Hide
        Appddevvv added a comment -

        Does this fix allow me to specify the contents of a user data dictionary using primitive and complex types?

        Show
        Appddevvv added a comment - Does this fix allow me to specify the contents of a user data dictionary using primitive and complex types?

          People

          • Assignee:
            Unassigned
            Reporter:
            Greg Brown
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development