Skip to content

Instantly share code, notes, and snippets.

@atetc
Last active August 28, 2015 10:45
Show Gist options
  • Save atetc/44d485795b4384126f9d to your computer and use it in GitHub Desktop.
Save atetc/44d485795b4384126f9d to your computer and use it in GitHub Desktop.
save inner to DB
@SQLiteObject("templates")
public class OkSettings {
@SuppressWarnings("unused")
@SQLitePk
private long mId;
@SQLiteColumn(Column.BASE_URL)
@SerializedName("templatesBaseUrl")
private String mBaseUrl;
@SerializedName("templateCategories")
private List<TemplateCategory> mCategories = new ArrayList<>();
public String getBaseUrl() {
return mBaseUrl;
}
public List<TemplateCategory> getCategories() {
return mCategories;
}
interface Column {
String BASE_URL = "base_url";
}
}
@SQLiteObject("categories")
public class TemplateCategory {
@SuppressWarnings("unused")
@SQLitePk
private long mId;
@SQLiteColumn(Column.ID)
@SerializedName("id")
private String mName;
public TemplateCategory() {
}
interface Column {
String ID = "name";
}
}
final List<TemplateCategory> categories = okSettings.getCategories();
SQLite.save(categories);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment