Example #1
0
    protected void parseObject(JSONObject object)
    {
        this.id = object.optString(FIELD_ID);
        this.str = object.optString(FIELD_STR);
        this.num = object.optLong(FIELD_NUM);
        this.flo = object.optDouble(FIELD_FLO);
        this.boo = object.optBoolean(FIELD_BOO);
        this.spa_ce = new Spa_ce(object.optJSONObject(FIELD_SPA_CE));
        this.special = new Special(object.optJSONObject(FIELD_SPECIAL));

        if (object.optJSONArray(FIELD_ARRDOUBLE) != null)
        {
            this.arrdouble = new ArrayList<>();
            JSONArray arrdoubleJsonArray = object.optJSONArray(FIELD_ARRDOUBLE);
            for (int i = 0; i < arrdoubleJsonArray.length(); i++) {
                Double arrdouble = arrdoubleJsonArray.optJSONDouble(i);
                this.arrdouble.add(new Double(arrdouble));
            }
        }

        if (object.optJSONArray(FIELD_ARRNUM) != null)
        {
            this.arrnum = new ArrayList<>();
            JSONArray arrnumJsonArray = object.optJSONArray(FIELD_ARRNUM);
            for (int i = 0; i < arrnumJsonArray.length(); i++) {
                Long arrnum = arrnumJsonArray.optJSONLong(i);
                this.arrnum.add(new Long(arrnum));
            }
        }

        if (object.optJSONArray(FIELD_ARRSTR) != null)
        {
            this.arrstr = new ArrayList<>();
            JSONArray arrstrJsonArray = object.optJSONArray(FIELD_ARRSTR);
            for (int i = 0; i < arrstrJsonArray.length(); i++) {
                String arrstr = arrstrJsonArray.optJSONString(i);
                this.arrstr.add(new String(arrstr));
            }
        }

        if (object.optJSONArray(FIELD_ARRBOO) != null)
        {
            this.arrboo = new ArrayList<>();
            JSONArray arrbooJsonArray = object.optJSONArray(FIELD_ARRBOO);
            for (int i = 0; i < arrbooJsonArray.length(); i++) {
                Boolean arrboo = arrbooJsonArray.optJSONBoolean(i);
                this.arrboo.add(new Boolean(arrboo));
            }
        }

        if (object.optJSONArray(FIELD_ARRNULL) != null)
        {
            this.arrnull = new ArrayList<>();
            JSONArray arrnullJsonArray = object.optJSONArray(FIELD_ARRNULL);
            for (int i = 0; i < arrnullJsonArray.length(); i++) {
                JSONObject arrnull = arrnullJsonArray.optJSONObject(i);
                this.arrnull.add(new Arrnull(arrnull));
            }
        }
        this.obj = new Obj(object.optJSONObject(FIELD_OBJ));

        if (object.optJSONArray(FIELD_ARROBJ) != null)
        {
            this.arrobj = new ArrayList<>();
            JSONArray arrobjJsonArray = object.optJSONArray(FIELD_ARROBJ);
            for (int i = 0; i < arrobjJsonArray.length(); i++) {
                JSONObject arrobj = arrobjJsonArray.optJSONObject(i);
                this.arrobj.add(new Arrobj(arrobj));
            }
        }

    }