|
|
|
[
Permlink
| « Hide
]
Werner Guttmann - 18/Oct/07 06:58 AM
Why don't you simply cast the FIeldDescriptor instance to XMLFIeldDescriptor, given that it is one ?
Can you attach a working JUnit test case that I could use to advise you what to do ?
Marking this as 'Won't fix' as discussed above. Please feel free to reopen at any time.
org.exolab.castor.xml.XMLFieldDescriptor f = (org.exolab.castor.xml.XMLFieldDescriptor) getFieldDescriptor();
==> ClassCastException: Cannot cast org.exolab.castor.mapping.loader.FieldDescriptorImpl (id=872624) to org.exolab.castor.xml.XMLFieldDescriptor Oops, my misunderstanding. Still (given the high load on myself and others), can you please attach a working JUnit test so that I don't have to 'reinvent' the wheel ?
if you wanted me to look at this before shipping the next release, I'd appreciate any help from your side (as indicated above).
Initial patch for review. As a result of this patch, an XMLFieldDescriptorImpl instance is accessible by calling getFieldDescriptor() within a custom FieldHandler implementation. Please note that I have not performed any testing at all .... to make sure that nothing gets broken.
Improved patch that has been tested against CTF - which still completes without a problem. Any feedback appreciated.
Btw, I have not changed the return type of the getFieldDescriptor() method. But it's now possible to cast the object instance returned to an instance of XMLFieldDescriptor(Impl).
In other words, code such as ...
public Object convertUponGet(Object arg0) {
FieldDescriptor descriptor = getFieldDescriptor();
if (descriptor instanceof XMLFieldDescriptor) {
XMLFieldDescriptor xmlDescriptor = (XMLFieldDescriptor) descriptor;
String nameSpaceURI = xmlDescriptor.getNameSpaceURI();
}
return new Character(((String) arg0).charAt(0));
}
works with problems. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||