Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- @NonNull
- public ColumnAdapter<Map<Subject, String>, String> dataConverter() {
- return new ColumnAdapter<Map<Subject, String>, String>() {
- @Override
- @NonNull
- public String encode(@NonNull Map<Subject, String> model) {
- if (model == null) return null;
- Type type = new TypeToken<Map<Subject, String>>(){}.getType();
- Gson gson = new Gson();
- return gson.toJson(model, type);
- }
- @Override
- public Map<Subject, String> decode(String model) {
- if (model == null) return null;
- Type type = new TypeToken<Map<Subject, String>>(){}.getType();
- Gson gson = new Gson();
- return gson.fromJson(model, type);
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement