java QmapsteemCreated with Sketch.

in java •  7 years ago 

public class Qmap extends HashMap<String, Object> {
public Qmap() {
super();
}

public Qmap(HashMap map) {
    super(map);
}

public String getStr(String k) {
    return (String) this.get(k);
}

public int getInt(String k) {
    return Qutl.toInt(this.get(k));
}

public Qrs getQrs(String storKey) {
    return (Qrs) this.get(storKey);
}

public Qrs newQrs(String storKey) {
    this.put(storKey, new Qrs());
    return (Qrs) this.get(storKey);
}

public Qmap getQmap(String storKey) {
    return (Qmap) this.get(storKey);
}

public Qmap newQmap(String storKey) {
    this.put(storKey, new Qmap());
    return (Qmap) this.get(storKey);
}

public JSONObject getJson() {
    JSONObject jsObj = new JSONObject();
    for (String key : this.keySet()) {
        Object o = this.get(key);
        if (o instanceof Qrs) {
            jsObj.put(key, ((Qrs) o).getJson());
        } else {
            jsObj.put(key, o);
        }
    }
    return jsObj;
}

}

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!