Hello,
I stumbled across the need to provide some user context information to the
unmarshalled objects. My first idea was to set the user context like this:
class Reader {
void parse(File file) {
IBindingFactory bfact = BindingDirectory.getFactory(
"mybindingname", MyObject.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
uctx.setUserContext(this); // Try to set 'this' as context!
FileInputStream oStream = new FileInputStream(file);
MyObject data = null;
try {
data = (MyObject) uctx.unmarshalDocument(oStream, null);
} finally {
oStream.close();
}
}
}
where
class MyObject {
private Reader reader;
public void preSet(IUnmarshallingContext ctx) {
reader = (Reader) ctx.getUserContext();
....
}
}
Regrettably this ansatz didn't work, because when MyObject.preSet
is called, ctx.getUserContext() returns null!
Is this a bug? If not, does there exist any possibility to transfer
a reference of the above mentioned Reader (who unmarshalls the stuff)
to the created objects?
Thanks in advance,
Daniel Krügler
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users