| A moderately capable deep cloner of beans. Will not cope with anything
unusual like multidimensional arrays, and assumes that every non-leaf object
encountered in the tree is default-constructible (including collections).
Also assumes that the object graph supplied is a tree.
Never uses Object.clone() but rather direct introspection and type inference,
so should run relatively like a rocket compared to most things out there
(once FastClass is integrated) - 60ns*nprops per bean rather than
900ns+16ns*nprops. (Cost per property - 1xFastClass, probably no constructs
(since immutable), perhaps 3 function calls, a loop it and a hashmap lookup).
Anyone capable of rewriting this code into the corresponding BCEL visitor is
strongly invited to do so.
author: Antranig Basman (antranig@caret.cam.ac.uk) |