-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- ObjectOutputStream os = new ObjectOutputStream(bos);
- os.writeObject(behavior);
- os.flush();
- ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
- ObjectInputStream ois = new ObjectInputStream(bis);
- behavior = (InjectionBehavior)ois.readObject();
-
- behavior.beforeRender(component);
+
+ behavior = ObjectSerializationUtils.deserialize(
+ ObjectSerializationUtils.serialize(behavior),
+ InjectionBehavior.class);
+
+ behavior.beforeRender(component);