yahoo / squidb

SquiDB is a SQLite database library for Android and iOS
https://github.com/yahoo/squidb/wiki
Apache License 2.0
1.31k stars 132 forks source link

Question: is is possible to import&export entities classes into strings? #158

Closed AndroidDeveloperLB closed 8 years ago

AndroidDeveloperLB commented 8 years ago

Suppose I have a class that has the annotation "@TableModelSpec" for it, which created an entity class. Is it possible to import&export the created class into a string (for example using a Json format) ?

jdkoren commented 8 years ago

I don't quite understand your question. Generally speaking, the generated class is exactly that: a Java class. You can do with it whatever you could do with any Java class. If your goal is in some way to serialize it, be aware that you must account for changes to the model spec (just as with serialization you must be wary of changes to the serialized class that make it impossible for Java to deserialize it from the persisted data).

sbosley commented 8 years ago

You could write a @ModelMethod to manually implement serialization, or if you're feeling very adventurous write a code generation plugin to automatically generate some serialization code.