Extending class at runtime
So for this project I am trying to extend a class at runtime. What I would like to know, is this even possible? If so, how would I do it? Are there libraries out there for these things? CGLib is a library you're looking for. It's quite powerfull in extending classes or implementing interfaces in runtime, so many popular frameworks, like Spring or Hibernate use it. You can create class extension with code like public Object createProxy(Class targetClass) { Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(targetClass); enhancer.setCallback(NoOp.INSTANCE); return enhancer.create(); }