Hi,
I think you're on the right track. Remember that you can safely overload
the setter without changing the name - I assume you have no interest in a
method
public String getRefNumberAsString();
? Anyway, what I would do is put a merge file in for the data object
template, and loop through all the persistent fields, creating methods like
public void setRefNumber(String p)
{
setRefNumber(new Integer(p));
}
have a look at the template, and hopefully you'll be able to figure it out.
hth
dim
----- Original Message -----
From: "Shaw, Chris" <[EMAIL PROTECTED]>
To: "xdoclet-user" <[EMAIL PROTECTED]>
Sent: Wednesday, February 20, 2002 1:19 AM
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
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user