Android Open Source - android-easy-db J S O N Array






From Project

Back to project page android-easy-db.

License

The source code is released under:

GNU General Public License

If you think the Android project android-easy-db listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.mauriciogiordano.easydb.helper;
/*from   w  w w  .  ja  v a  2  s . c  o  m*/
import org.json.JSONException;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

public class JSONArray extends org.json.JSONArray {

    private List reflectedValuesList;

    private boolean found = false;

    public JSONArray() {
        super();
    }

    public JSONArray(String a) throws JSONException {
        super(a);

        try {
            Field field = getClass().getSuperclass().getDeclaredField("values");
            field.setAccessible(true);

            reflectedValuesList = (ArrayList) field.get(this);

            found = true;
        } catch(NoSuchFieldException e) {
            e.printStackTrace();
        } catch(IllegalAccessException e) {
            e.printStackTrace();
        }
    }

    public void pop(int index) {
        if(found) {
            reflectedValuesList.remove(index);
        } else {
            // TODO
        }
    }
}




Java Source Code List

com.mauriciogiordano.easydb.ApplicationTest.java
com.mauriciogiordano.easydb.bean.HasManyModel.java
com.mauriciogiordano.easydb.bean.HasOneModel.java
com.mauriciogiordano.easydb.bean.Model.java
com.mauriciogiordano.easydb.helper.JSONArray.java