I don't know anything about how XDoclet variables work, but if they aren't immutable, you could do the equivalent of
append method name ( sep = "" loop append sep <next variable> sep = ", " end loop david jencks On 2002.02.20 07:45:47 -0500 "Shaw, Chris" wrote: > Hi, > > I was thinking along the lines of having a 'string-only' > constructor....in > addition to the current one(s)...(maybe it is better, if parsing through > XML, to just call a set method for each parameter as they are found > anyway > but...) > > So I was working on the premise that I would need a comma-separated list > as > the arguments passed in... > public ObjectData(java.lang.String paramOne, java.lang.String > paramTwo, > etc) > > and then in this constructor, as you suggested, I would simply call > overriden methods (for which the arguments are obviously not already a > String as they don't need to be overriden). > > The problem here is knowing which argument is the last one and hence not > printing the last comma.... > > C. > -- > > > > -----Original Message----- > From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]] > Sent: 20 February 2002 13:32 > To: Shaw, Chris; 'xdoclet-user' > Subject: Re: [Xdoclet-user] Data Object and Strings > > > 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 > > > > 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
