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

cn.hyperchain.sdk.response.config.HostsResponse Maven / Gradle / Ivy

There is a newer version: 1.4.3
Show newest version
package cn.hyperchain.sdk.response.config;

import cn.hyperchain.sdk.response.Response;
import com.google.gson.annotations.Expose;

import java.util.Base64;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class HostsResponse extends Response {

    @Expose
    private Map result;

    /**
     * convert result to hosts.
     *
     * @return {@link Map}
     */
    public Map getHosts() {
        Map hosts = new HashMap<>();
        Iterator> iterator = result.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry next = iterator.next();
            hosts.put(next.getKey(), new String(Base64.getDecoder().decode(next.getValue())));
        }
        return hosts;
    }

    @Override
    public String toString() {
        return "HostsResponse{" +
                "result=" + result +
                ", jsonrpc='" + jsonrpc + '\'' +
                ", id='" + id + '\'' +
                ", code=" + code +
                ", message='" + message + '\'' +
                ", namespace='" + namespace + '\'' +
                '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy