Hi Werner,

I've only been able to map each pair key/value of an hashmap to a new
element, just like you mentioned.

It would be a great improvement to have a more flexible way of dealing
with hashmaps.
I would not mind helping you adding such a functionality , since I
would enjoy using Castor in my project.

Just tell me how I can be useful. Developing, debugging, suggesting ideas...

Regards,
Daniel Garrido

On Fri, Apr 25, 2008 at 9:50 PM, Werner Guttmann
<[EMAIL PROTECTED]> wrote:
> Daneil,
>
>  this is the right place to suggest such a feature (CCing the dev list as
>  well). Having said that, let me just add a few random observations:
>
>  a) Castor currently does support (Hash)Maps as collection type for
>  multivalued collections, as per mapping file and through code generation.
>
>  b) The syntax is a bit more complicated as for other collection types,
>  as we do need some flexibility to define the XML binding for the
>  key/value pair.
>
>  c) As far as I know, this is being used for element type content only.
>
>  As such, I have to confess that I have never tried to use this against
>  attribute type. Looks like I have to try this first.
>
>  Having said that, if this is not supported, support for such a feature
>  could be added. Would you be willing to work with us to add such a
>  feature ?
>
>  Regards
>  Werner
>  Castor, committer
>
>  Daniel Garrido wrote:
>  > Thank you for your answer!
>  > Where shall I post a suggestion?
>  > I think it would be interesting that we could map XML like:
>  >
>  > <node attr1="val1" attr2="val2" attr3="val3" attr4="val4" ... />
>  >
>  > To an Hashmap where the keys would be the name of the attribute and
>  > the attribute's values the values associated to the keys of the
>  > hashmap.
>  >
>  > Don't know if this is the right place for suggestions, if not I would
>  > appreciate if someone tell me where to forward this idea.
>  > I feel sorry I can't use Castor :(, everything was working so nice
>  > till this limitation.
>  >
>  > Best regards,
>  > Daniel Garrido
>  >
>  > On Fri, Apr 25, 2008 at 9:05 AM, Werner Guttmann
>  > <[EMAIL PROTECTED]> wrote:
>  >> Daniel,
>  >>
>  >>
>  >>
>  >>  Daniel Garrido wrote:
>  >>  > Hello Castor community!
>  >>  >
>  >>  >  Is it possible to do the following:
>  >>  >
>  >>  >  Imagine I have the following XML, that I wish to unmarshall:
>  >>  >
>  >>  >  <component id="scanner" name="Scanner">
>  >>  >         <model id="1" name="Foo" forecastMaintHours="80"
>  >>  >  hourPrice="90" partsPrice="2800" />
>  >>  >         <model id="2" name="Bar" forecastMaintHours="150"
>  >>  >  hourPrice="90" partsPrice="14000"/>
>  >>  >  </component>
>  >>  >
>  >>  >  I have a component class:
>  >>  >
>  >>  >  public class Component {
>  >>  >
>  >>  >         private String id;
>  >>  >         private String name;
>  >>  >         private List<Model> models;
>  >>  >
>  >>  >  ...
>  >>  >  }
>  >>  >
>  >>  >  A model class:
>  >>  >
>  >>  >  public class Model {
>  >>  >
>  >>  >         private String id;
>  >>  >         private List<ModelAttribute> attributes;
>  >>  >
>  >>  >  ...}
>  >>  >
>  >>  >  and finally a ModelAttribute class (basically it's purpose it to be 
> an hashmap:
>  >>  >
>  >>  >  public class ModelAttribute {
>  >>  >
>  >>  >         public String name;
>  >>  >         public String value;
>  >>  >  ...}
>  >>  >
>  >>  >  Now my question is, how can I map a custom name of a model attribute
>  >>  >  to the ModelAttribute.name and its value to ModelAttribute.value?
>  >>  This - to my knowledge - is not supported with Castor.
>  >>
>  >>  >
>  >>  >  Best regards,
>  >>  >  Daniel Garrido
>  >>  >
>  >>  > ---------------------------------------------------------------------
>  >>  > To unsubscribe from this list, please visit:
>  >>  >
>  >>  >     http://xircles.codehaus.org/manage_email
>  >>  >
>  >>  >
>  >>  >
>  >>
>  >>
>  >>  ---------------------------------------------------------------------
>  >>  To unsubscribe from this list, please visit:
>  >>
>  >>     http://xircles.codehaus.org/manage_email
>  >>
>  >>
>  >>
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe from this list, please visit:
>  >
>  >     http://xircles.codehaus.org/manage_email
>  >
>  >
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to