Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Annotate greenDao generated object

I see that greenDao prefers not to use annotations for DAO and TO generation due to performance issues. However what if I still need to annotate for instance a TO for parser purposes? Is there any way to achieve that?

Example:

If we create a Customer entity with GreenDAO code generation, it will create the CustomerDAO and the Customer classes, right?

So, what if I`m consuming SOAP webservices, which returns a Customer object, and to facilitate parsing this Customer object I use an annotated kind of framework like simpleXML. Is there any way to change the Customer class without loose every annotation when regenerating code with GreenDAO?

Thanks!

like image 831
user1855284 Avatar asked Dec 09 '22 19:12

user1855284


1 Answers

You can add annotations with greendao 2.0 like this

entity.addStringProperty("title").codeBeforeField("@com.google.gson.annotations.SerializedName( \"title\" )");
like image 178
arsent Avatar answered Dec 11 '22 11:12

arsent