[Apologies if this turns out to be a repost; I attempted to post via
gmane newsgroup and got two email responses - one indicating success and
one indicating failure. So I don't know if that post went through or not.]
I'm interested in serializing a bunch of existing java objects that all
follow the same idiom:
class Foo {
final int arg;
private Foo (int arg) {
this.arg = arg;
}
public static Foo newFoo (int arg) {
return new Foo(arg);
}
public int getArg () {
return arg;
}
}
Is it possible to define a mapping file that can work with this class?
It doesn't have a public constructor, so I immediately ran into that
MappingException. I read (and reread and reread) the tips-and-tricks
paragraphs on use of the "create-method" in the mapping, but couldn't
figure out how to make it apply -- its not a property of my Foo that I
need created, but the Foo itself. I found posts in the archives dealing
with use of FieldHandlers to provide flexibility for constructing
objects; but again -- those seem to apply to creating objects on a
class. In some of my cases, the Foo will be the root element in the
mapping.
Is this possible? If so, any pointers to where I can learn how? If
not, is there a particular reason why not (meaning, would developers be
open to support of this if it was possible to define a mapping that
described it and I could provide such a patch (which is not to say I
have such a patch yet, but I would be willing to dig into it))?
Thanks,
Paul Christmann
[EMAIL PROTECTED]
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
- Re: [castor-dev] [XML] Mapping and static factory methods Paul Christmann
- Re: [castor-dev] [XML] Mapping and static factory met... Rhett Sutphin
- Re: [castor-dev] [XML] Mapping and static factory met... Keith Visco
- [castor-dev] Re: [XML] Mapping and static factory... Paul Christmann
