How to implement a builder class using Generics, not annotations?
问题 I want to write a generic builder class which wraps around any java class and providing setter functions of a specific style. I am not sure if this could be called "dynamically generated functions". When I have a beanish Pojo class i.e. class Pojo { public void setValue(int value) {...} public void setName(String name) {...} } My Maker class should be usable like this: Pojo p = Builder<Pojo>.create(new Pojo()) .setName("Funny") .setValue(123) .build(); As you can see, the work it does should