Code example for Properties

Methods: getProperty

0
    // } 
 
    public static ZKConfig getZkConfig(final Properties props) {
        if (props != null) {
            boolean zkEnable = true;
            if (!com.taobao.gecko.core.util.StringUtils.isBlank(props.getProperty("zk.zkEnable"))) {
                zkEnable = Boolean.valueOf(props.getProperty("zk.zkEnable"));
            } 
            String zkRoot = "/meta";
            if (!com.taobao.gecko.core.util.StringUtils.isBlank(props.getProperty("zk.zkRoot"))) {
                zkRoot = props.getProperty("zk.zkRoot");
            } 
            final ZKConfig rt =
                    new ZKConfig(zkRoot, props.getProperty("zk.zkConnect"), Integer.parseInt(props
                        .getProperty("zk.zkSessionTimeoutMs")), Integer.parseInt(props
                        .getProperty("zk.zkConnectionTimeoutMs")), Integer.parseInt(props
                        .getProperty("zk.zkSyncTimeMs")), zkEnable);
 
            return rt;
        } 
        else { 
            throw new NullPointerException("Null zk config");