Android Open Source - LicenseModuleChecker-Client-Android R Data Deserialize






From Project

Back to project page LicenseModuleChecker-Client-Android.

License

The source code is released under:

<?xml version="1.0" encoding="UTF-8"?> <module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4"> <comp...

If you think the Android project LicenseModuleChecker-Client-Android 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.asynhkm.productchecker.schema;
/*from  w  w w .  j  a v a 2s.  c o  m*/
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;

import java.lang.reflect.Type;

/**
 * Created by Hesk on 3/12/2014.
 * <p/>
 * <p/>
 * <p/>
 * final Type typeOfrouteNode = new TypeToken<List<RouteNode>>() {
 * }.getType();
 * <p/>
 * final ArrayList<RouteNode> contextnode_r = c.deserialize(j.get("routenode").getAsJsonArray(), typeOfrouteNode);
 */
public class RDataDeserialize implements JsonDeserializer<ReturnData> {
    @Override
    public ReturnData deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        ReturnData runtime;
        try {
            String t = json.getAsString();
            if (t.equalsIgnoreCase("")) {
                runtime = new ReturnData();
            } else {
                final JsonObject jj = json.getAsJsonObject();
                runtime = context.deserialize(jj, ReturnData.class);
            }
            //  final JsonObject jj = json.getAsJsonObject();
            runtime = context.deserialize(json, ReturnData.class);
        } catch (JsonParseException e) {
            runtime = new ReturnData();
            throw e;
        } catch (Exception e) {
            runtime = new ReturnData();
            // throw new ParseException(e.toString());
        }
        return runtime;
        //  return json.getAsJsonPrimitive().;
    }
}




Java Source Code List

com.asynhkm.example.ApplicationTest.java
com.asynhkm.example.MainExample.java
com.asynhkm.productchecker.ApplicationTest.java
com.asynhkm.productchecker.PreferenceControl.java
com.asynhkm.productchecker.Checker.CheckerCB.java
com.asynhkm.productchecker.Checker.CheckerTask.java
com.asynhkm.productchecker.Checker.HKMCheckerPlugable.java
com.asynhkm.productchecker.Checker.param.java
com.asynhkm.productchecker.Util.JSONReader.java
com.asynhkm.productchecker.Util.RootDialog.java
com.asynhkm.productchecker.Util.Tool.java
com.asynhkm.productchecker.schema.DataProductVersion.java
com.asynhkm.productchecker.schema.RDataDeserialize.java
com.asynhkm.productchecker.schema.RRDeserialize.java
com.asynhkm.productchecker.schema.ReturnData.java
com.asynhkm.productchecker.schema.ReturnResult.java
com.asynhkm.productchecker.schema.requestCheck.java