private Map<String, Cloner> clonerMap = new HashMap<String, Cloner>();
public void processEvent(Object event) {
Object newEvent = event;
if (transformers != null && transformers.length > 0) {
Cloner cloner = clonerMap.get(event.getClass().getName());
if (cloner == null) {
ClonerGenerator cg = new ClonerGenerator();
// generate byte code that knows how to call the clone method on
// this event
Class clonerClass = cg.generate(event.getClass());
try {
cloner = (Cloner) clonerClass.newInstance();
clonerMap.put(event.getClass().getName(), cloner);
} catch (InstantiationException ie) {
Logger.getLogger(this.getClass()).error(ie);
throw new RuntimeException(ie);
} catch (IllegalAccessException ias) {
Logger.getLogger(this.getClass()).error(ias);
throw new RuntimeException(ias);
}
}
newEvent = cloner.clone(event);
}
for (Transformer transformer : transformers) {
newEvent = transformer.transform(newEvent);
if (newEvent == null) {