0

we'd like to put a layer between GreenDao and the app, so we can keep these layer classes fixed and re-generate GreenDao when needed. Also, we would like to extend these classes with new methods and properties.

I came to know there's the "keep sections" trick but we don't like this approach since (if I got it right) we could not use the "delete folder - recreate dao" approach.

Is there any other way to get this behaviour? Maybe decoration could be an alternative? Did anyone implement a layer between GreenDao and the app before?

Thank you so much

  • I don't see the advantage of these layer classes as they would have to be changed as well if your schema gets updated. – AlexS Mar 15 '14 at 08:16
  • Why do you prefer the delete folder approach. I put the generated classes into my svn as well and update the schema if needed. – AlexS Mar 15 '14 at 08:22

1 Answers1

0

Create an abstract parameterized class, something like

final class AbstractImpl<T>{
    private Class<?> controller=null; 
    private Object ctrlInstance=null; 
    private Class<?> dataClass=null; 
    private String className=null;  

    public AbstractImpl(String dataClassName){}
}

using

java.reflection API

like .getDeclaredMethod() .invoke()

O_T
  • 379
  • 3
  • 14