ported to scala, working example of Sandeep Awasthi Javassist example