All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.opendynamic.OdResult Maven / Gradle / Ivy

There is a newer version: 1.0.1-RELEASE
Show newest version
package com.opendynamic;

import java.util.List;
import java.util.Map;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class OdResult {
    private Map result;

    @SuppressWarnings("unchecked")
    public OdResult(String data) {
        Gson gson = new GsonBuilder().create();
        result = gson.fromJson(data, Map.class);
    }

    public Map getResult() {
        return result;
    }

    public boolean getSuccess() {
        return (Boolean) result.get("success");
    }

    public int getTotal() {
        return ((Double) result.get("total")).intValue();
    }

    @SuppressWarnings("unchecked")
    public Map getObject(String key) {
        return (Map) result.get(key);
    }

    @SuppressWarnings("unchecked")
    public List> getObjectList(String key) {
        return (List>) result.get(key);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy