Considering the commonality and flexibility of our project, we need to add fields and related get/set methods into a basic class with a array of columns from a XML
configuration file. I was thinking of Cglib and did a study about it.
I've learned that how to use Cglib to implement AOP functionality in application like this:
public static SampleManager getSelectivityAuthInstance(AuthProxy auth) {
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(SampleManager .class);
enhancer.setCallbacks(new Callback[] { auth, NoOp.INSTANCE });
enhancer.setCallbackFilter(new AuthProxyFilter());
return (SampleManager ) enhancer.create();
}
There is insufficient resources for learning and researching Cglib on the internet. I was wishing to get a help from here. Following is my question in detail.
1, I have a basic POJO class BasicUser
which is empty primitively.
2, Application should have ability to read a list of fields that includes information like name, data type, length,etc from project.xml
, and add these fields in the BasicUser class, and then application uses the new class updated by Cglib
to reach business requirements.
I ever thought to use Map to implement it, but it's not technical. Can anybody professional gives me guidance.