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 643B

1234567891011121314151617181920212223242526272829303132
  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 abstract void fromJson(JSONObject json) throws JSONException;
  10. public abstract HashMap<String, Object> toArray();
  11. public void fromString(String data) throws JSONException
  12. {
  13. JSONObject json = new JSONObject(data);
  14. fromJson(json);
  15. }
  16. public JSONObject toJson()
  17. {
  18. return new JSONObject(toArray());
  19. }
  20. @Override
  21. public String toString() {
  22. return toJson().toString();
  23. }
  24. }