return listener;
}
public void beforeMarshal(Object obj) {
if(classBasedMarshalEvents != null) {
MarshalCallback callback = (MarshalCallback)classBasedMarshalEvents.get(obj.getClass().getName());
if(callback != null && callback.getBeforeMarshalCallback() != null) {
try {
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try{
AccessController.doPrivileged(new PrivilegedMethodInvoker(callback.getBeforeMarshalCallback(), obj, new Object[]{marshaller}));
}catch (PrivilegedActionException ex){
if (ex.getCause() instanceof IllegalAccessException){
throw (IllegalAccessException) ex.getCause();
}
if (ex.getCause() instanceof InvocationTargetException){
throw (InvocationTargetException) ex.getCause();
}
throw (RuntimeException)ex.getCause();
}
}else{
PrivilegedAccessHelper.invokeMethod(callback.getBeforeMarshalCallback(), obj, new Object[]{marshaller});
}
} catch(Exception ex) {
throw XMLMarshalException.marshalException(ex);
}
}