You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LuDbo.java 639B

12345678910111213141516171819202122232425262728293031
  1. package com.luticate.utils.dbo;
  2. import org.json.JSONException;
  3. import org.json.JSONObject;
  4. import java.util.HashMap;
  5. /**
  6. * Created by robin on 11/27/15.
  7. */
  8. public abstract class LuDbo {
  9. public void fromString(String data) throws JSONException {
  10. JSONObject json = new JSONObject(data);
  11. fromJson(json);
  12. }
  13. public abstract void fromJson(JSONObject json) throws JSONException;
  14. public abstract HashMap<String, Object> toArray();
  15. public JSONObject toJson()
  16. {
  17. return new JSONObject(toArray());
  18. }
  19. @Override
  20. public String toString() {
  21. return toJson().toString();
  22. }
  23. }