Why not <XDtEjbPersistent:forAllPersistentFields superclasses="false"> java.lang.String <XDtMethod:propertyName/>AsString; </XDtEjbPersistent:forAllPersistentFields>)
also remember that if this is to go in the dataobject class, you will have namespace issues if you use <XDtMethod:propertyName /> - hence my appending of 'AsString' to the name. cheers dim ----- Original Message ----- From: "Shaw, Chris" <[EMAIL PROTECTED]> To: "'xdoclet-user'" <[EMAIL PROTECTED]> Sent: Wednesday, February 20, 2002 8:42 PM Subject: RE: [Xdoclet-user] Data Object and Strings > Hi, > > Quick question...(?) > Is it possible to do something like the following? (or am I tackling it > wrong?) > > (<XDtEjbPersistent:forAllPersistentFields superclasses="false"> > java.lang.String <XDtMethod:propertyName/> > > <**ifNotLastPeristentFieldThenPrintThis**>,</**ifNotLastPeristentFieldThenPr > intThis**> > </XDtEjbPersistent:forAllPersistentFields>) > > Thanks > > Chris > -=-=-= > > -----Original Message----- > From: Ara Abrahamian [mailto:[EMAIL PROTECTED]] > Sent: 19 February 2002 18:49 > To: Shaw, Chris; 'xdoclet-user' > Subject: RE: [Xdoclet-user] Data Object and Strings > > > Write a template and decide on the type what to do. You have to do a lot > of if/elses and handle each type differently. You can also write > decoders (like the way Soap converts types from string to java, using a > set of demarshallers). > > In my application I'm doing the reverse: I construct an > XmlConfiguration, passing in a Class, load an xml file, look at the > Class and for each attribute I try to do a getMethod("get"+attrname), > then I check the type of the return type and in a big if/else convert > the string to the return type of the method and do a "set"+attrname() > passing in the converted value. I handle it in runtime, and based on the > assumption that there's get/set for attributes of the xml file in the > bean. It's pricier in runtime obviously. You may be interested to handle > it using Castor XML for example. It's also absolutely possible to > implement using a specialized xdoclet template files. Depends on your > taste :o) If I were to implement it now I would write a template (I'm > writing templates each day for various automation cases I face in our > app!!), using the strategy dataobject generation uses. Actually the > tricky part is the type conversion part because there's no generic way > to handle it and you should tackle it case by case for each type. > > Cheers, > Ara. > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:xdoclet-user- > > [EMAIL PROTECTED]] On Behalf Of Shaw, Chris > > Sent: Tuesday, February 19, 2002 5:49 PM > > To: xdoclet-user > > Subject: [Xdoclet-user] Data Object and Strings > > > > Hi, > > > > The project I am working on receives input (in a variety of ways) as > XML. > > Naturally, data will be in string format..... > > > > Does anyone have any ideas on how best to get String parameters as > Java > > Objects (String, Integer, Date etc) into the XDoclet-generated Data > > Object....? > > > > Simple field validation (type/constraints) is automatically > handled....so > > the only thing left (apart from complex validation) is to create the > > correct > > types. > > > > By default the XDoclet generated Data Object already knows the correct > > type > > for an Object... > > For example I could have: > > > > setRefNumber(java.lang.Integer refNumber) { > > this.refNumber = refNumber; > > } > > > > What I really want, for *all* my object attributes, is something > like... > > setRefNumberFromString(java.lang.String refNumber) { > > this.refNumber = new Integer(refNumber); > > ) > > > > How can this best be achieved in the current framework? (or are there > > better > > ways of doing this?) > > I want to try and generate as much as possible and avoid having to > > hand-write such trivial things.....something the XDoclet concept > alreadt > > plays a *big* part in. > > > > Thanks > > > > Chris > > -=-=-= > > > > Any e-mail message from the European Central Bank (ECB) is sent in > good > > faith but shall neither be binding nor construed as constituting a > > commitment by the ECB except where provided for in a written > agreement. > > This e-mail is intended only for the use of the recipient(s) named > above. > > Any unauthorised disclosure, use or dissemination, either in whole or > in > > part, is prohibited. > > If you have received this e-mail in error, please notify the sender > > immediately via e-mail and delete this e-mail from your system. > > > > > > _______________________________________________ > > Xdoclet-user mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/xdoclet-user > > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > Any e-mail message from the European Central Bank (ECB) is sent in good faith but shall neither be binding nor construed as constituting a commitment by the ECB except where provided for in a written agreement. > This e-mail is intended only for the use of the recipient(s) named above. Any unauthorised disclosure, use or dissemination, either in whole or in part, is prohibited. > If you have received this e-mail in error, please notify the sender immediately via e-mail and delete this e-mail from your system. > > > _______________________________________________ > Xdoclet-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/xdoclet-user > _______________________________________________ Xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
