You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Inger, Matthew" <In...@Synygy.com> on 2004/06/01 23:04:07 UTC

[betwixt] Writing Map entries issue

One other issue, when writing map objects, we get XML like
the following:

  <entry>
    <key>6</key>
    <value>
      <itemNo>6</itemNo>
      <itemName>GlobalParameter6</itemName>
      <itemDesc>Global Parameter for Betwixt</itemDesc>
      <parentItemNo>0</parentItemNo>
      <parentItemName/>
      <dataType value="8" valueAsInteger="8" desc="Boolean">
        <valueAsObject>8</valueAsObject>
      </dataType>
      <parameterValue>true</parameterValue>
    </value>
  </entry>

Shouldn't the "value" part have another subelement which represents
the type?  Otherwise, how is a map supposed to be read back in?

Is there something i'm missing?

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [betwixt] Writing Map entries issue

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On 1 Jun 2004, at 22:04, Inger, Matthew wrote:

> One other issue, when writing map objects, we get XML like
> the following:
>
>   <entry>
>     <key>6</key>
>     <value>
>       <itemNo>6</itemNo>
>       <itemName>GlobalParameter6</itemName>
>       <itemDesc>Global Parameter for Betwixt</itemDesc>
>       <parentItemNo>0</parentItemNo>
>       <parentItemName/>
>       <dataType value="8" valueAsInteger="8" desc="Boolean">
>         <valueAsObject>8</valueAsObject>
>       </dataType>
>       <parameterValue>true</parameterValue>
>     </value>
>   </entry>
>
> Shouldn't the "value" part have another subelement which represents
> the type?  Otherwise, how is a map supposed to be read back in?

but having a subelement would make things so much easier :)

when the adder method for the map is strongly typed then betwixt can 
guess what type of object should be created. for example, if the adder 
is 'add(Key key, Value value)' then the type of the value object must 
be Value. of course, if Value happens to be an abstract class or an 
interface then there are more wrinkles. you'll probably need to use 
derived beans (which don't work properly at the moment :(

> Is there something i'm missing?

yes, the refactoring branch ;)

this stuff can't really be made to work with the older reading design. 
there is still a lot of functionality missing around this area but it's 
reasonably easier to add with the new design :)

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org