Jakub, Stephen

I am almost 100% sure that there's already (at least?) one Jira issue for
this problem (and no, I don't have its number to share with you ... ;-)). If
so, can you please add your findings to this issue(s) for the sake of
completeness.

Thanks
Werner

PS If there's more than one issue, can you please link there using the Link
command in Jira. Makes life easier when starting to work on a patch for this
particular problem.

> --- Ursprüngliche Nachricht ---
> Von: "Jakub Milkiewicz" <[EMAIL PROTECTED]>
> An: [email protected]
> Betreff: Re: [castor-user] hashtable mapping with interface
> implementations
> Datum: Thu, 13 Apr 2006 10:21:15 +0200
> 
> Hi Stpehen
> I followed your advice and it works.
> If you try to find solution for the problem, another hint :I am using
> castor
> 0.9.9.1.
> Thanks for your reply
> 
> 
> 
> 2006/4/12, Stephen Bash <[EMAIL PROTECTED]>:
> >
> > Jakub-
> >
> > I've also observed this problem in the past few months with Castor.
> > Unfortunately I haven't had time to track down a source of the
> > problem.  One work-around you can try is to define defining the type
> > attribute for the value as java.lang.Object.  It's hackish, but I
> > think I snuck some things by Castor doing that.
> >
> > And thanks for the detailed message, it will be helpful when I get
> > around to investigating the problem.
> >
> > Stephen
> >
> >
> > On 4/12/06, Jakub Milkiewicz <[EMAIL PROTECTED]> wrote:
> > > Hi
> > >  i would like to create hashtable mapping. I want to have my Brand
> > object to
> > >  contain hashtable of validators, where the keys in the hashmap will
> be
> > >  values of step attributes and the values will be implementations of
> > >  validator interface.
> > >  My mapping looks like this:
> > >
> > >  <mapping xmlns="http://castor.exolab.org/";
> > >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > >     xsi:schemaLocation="http://castor.exolab.org/
> > >  http://castor.org/mapping.xsd";>
> > >     <class name="com.sth.configurati
> > > on.Configuration">
> > >         <map-to xml="configuration"/>
> > >         <field collection="arraylist" name="brands"
> > > type="com.sth.configuration.Brand ">
> > >             <bind-xml name="brand" node="element"/>
> > >         </field>
> > >     </class>
> > >     <class name="com.sth.configuration.Brand">
> > >         <map-to xml="brand"/>
> > >         <field name="name">
> > >             <bind-xml name="name" node="attribute"/>
> > >         </field>
> > >         <field name="parser"
> > > type="com.sth.configuration.parsers.BrandParser ">
> > >             <bind-xml name="parser" node="element"/>
> > >         </field>
> > >               <field name="validators" collection="hashtable"
> > > container="false">
> > >             <bind-xml name="validators" node="element">
> > >                 <class
> > > name="org.exolab.castor.mapping.MapItem">
> > >                     <field name="key" type=" java.lang.Integer">
> > >                         <bind-xml name="step" node="attribute"/>
> > >                     </field>
> > >                     <field name="value"
> > > type=" com.sth.configuration.model.Validator">
> > >                         <bind-xml name="implementation"
> node="element"/>
> > >                     </field>
> > >                 </class>
> > >             </bind-xml>
> > >         </field>
> > >     </class>
> > >     </mapping>
> > >
> > > My conf file as follows:
> > >
> > >   <brand name="newBrand">
> > >         <parser
> > > xsi:type="java:
> > > com.sth.configuration.parsers.DefaultParser"/>
> > >            <validators>
> > >             <validator step="1">
> > >                 <implementation
> > > xsi:type="java:com.sth.validators.validator "></implementation>
> > >
> > >             </validator>
> > >             <validator step="2">
> > >                 <implementation
> > > xsi:type="java:com.sth.validators.validator2"></implementation>
> > >
> > >             </validator>
> > >         </validators>
> > >     </brand>
> > > </configuration>
> > >
> > > and my class
> > > public class Brand {
> > >         private BrandParser parser;
> > >         private Hashtable validators;
> > > }
> > >
> > > After unmarshalling i got:
> > > org.exolab.castor.mapping.MappingException: The return type
> > > for method
> > > public java.lang.Object
> > > org.exolab.castor.mapping.MapItem.getValue() does
> > > not match the declared field type
> > > com.sth.configuration.model.Validator at
> > > org.exolab.castor.mapping.loader.MappingLoader.findAccessor(
> > MappingLoader.ja
> > > va:1231)
> > >         at
> > > org.exolab.castor.mapping.loader.MappingLoader.createFieldHandler
> > (MappingLoa
> > > der.java:973)
> > >         at
> > > org.exolab.castor.mapping.loader.MappingLoader.createFieldDesc
> > (MappingLoader
> > > .java:776)
> > >         at
> > > org.exolab.castor.xml.XMLMappingLoader.createFieldDesc(
> > XMLMappingLoader.java
> > >  :369)
> > >         at
> > > org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs
> > (MappingLoade
> > > r.java:639)
> > >         at
> > > org.exolab.castor.mapping.loader.MappingLoader.createDescriptor
> > (MappingLoade
> > > r.java:462)
> > >         at
> > > org.exolab.castor.xml.XMLMappingLoader.createDescriptor(
> > XMLMappingLoader.jav
> > > a:227)
> > >         at
> > > org.exolab.castor.xml.XMLMappingLoader.createFieldDesc(
> > XMLMappingLoader.java
> > > :481)
> > >         at
> > > org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs
> > (MappingLoade
> > > r.java:639)
> > >         at
> > > org.exolab.castor.mapping.loader.MappingLoader.createDescriptor
> > (MappingLoade
> > > r.java:462)
> > >         at
> > > org.exolab.castor.xml.XMLMappingLoader.createDescriptor(
> > XMLMappingLoader.jav
> > > a:227)
> > >         at
> > > org.exolab.castor.mapping.loader.MappingLoader.loadMapping(
> > MappingLoader.jav
> > > a:313)
> > >         at org.exolab.castor.mapping.Mapping.getResolver
> > > (Mapping.java:292)
> > >         at
> > > org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:247)
> > >         at
> > > org.exolab.castor.xml.Unmarshaller.setMapping(Unmarshaller.java:475)
> > >         at org.exolab.castor.xml.Unmarshaller
> > > .<init>(Unmarshaller.java:246)
> > >
> > > Any help
> >
> 

-- 
Analog-/ISDN-Nutzer sparen mit GMX SmartSurfer bis zu 70%!
Kostenlos downloaden: http://www.gmx.net/de/go/smartsurfer

-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to