Reputation: 856
I am using google-http-java-client library to simplify my communication with web and automate parsing server's responses. So I need to annotate members of my POJO classes by annotattion @Key(name) like in this example:
public static class Video {
@Key
public String id;
@Key
public String title;
@Key
public String url;
}
After I receive server's response I want to save these entities into database. So I have to generate this class by GreenDAO. And main question is how I can insert anotations @Key into generated class? Yes, I know I can insert some code into generated class. This topic describes this ability. But as I understand I can insert only custom members, methods and includes.
Upvotes: 1
Views: 388
Reputation: 38253
you can take a look at Path's fork and use at your own risk. it has support for adding annotations.
Upvotes: 1
Reputation: 7075
Sorry, this is not currently supported by greenDAO. For future reference, I opened a ticket: https://github.com/greenrobot/greenDAO/issues/66
There are ways to work around this, but you must be cautious. You can stop generating certain entities using yourEntity.setSkipGeneration(true)
. If you decide to go this road you must always supply a constructor like the generated code does. Keep this in mind if properties change.
Upvotes: 0