commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Inger, Matthew" <In...@Synygy.com>
Subject RE: [betwixt] Writing Map entries issue
Date Wed, 02 Jun 2004 20:35:25 GMT
Why wouldn't the element name be determined at runtime?

<entry>
   <key>6</key>
   <value>
     <RealElementType></RealElementType>
   </value>
</entry>

It would make sense when generating the XML for the value
element to pull the Element Descriptor for the actual value
object (this all applies to the key as well).

Creation on the fly:

	1. Create <value> element descriptor
      2. Get value from the Map.Entry
      3. Get ElementDescriptor for the value
      4. Add that to the <value> element descriptor as a subelement


-----Original Message-----
From: robert burrell donkin
[mailto:robertburrelldonkin@blueyonder.co.uk]
Sent: Wednesday, June 02, 2004 4:17 PM
To: Jakarta Commons Developers List
Subject: Re: [betwixt] Writing Map entries issue


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

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


Mime
View raw message