當前位置: 首頁>>代碼示例>>Java>>正文


Java Config.getStringList方法代碼示例

本文整理匯總了Java中com.typesafe.config.Config.getStringList方法的典型用法代碼示例。如果您正苦於以下問題:Java Config.getStringList方法的具體用法?Java Config.getStringList怎麽用?Java Config.getStringList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.typesafe.config.Config的用法示例。


在下文中一共展示了Config.getStringList方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createClient

import com.typesafe.config.Config; //導入方法依賴的package包/類
private TransportClient createClient() {
    Config cfg = getTypeCfg();
    Settings settings = Settings.builder().put("cluster.name", cfg.getString("elastic.cluster-name")).build();
    TransportClient client = new PreBuiltTransportClient(settings);

    List<String> servers = cfg.getStringList("elastic.servers");
    logger.debug(marker, "Elastic Servers: {}", servers);
    for (String addr : servers) {
        try {
            String[] a = addr.split(":");
            String host = a[0];
            int port = Integer.parseInt(a[1]);
            client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(host), port));
        } catch (Exception e) {
            logger.error(marker, "Transport client creation failed for '{}'", addr, e);
        }
    }

    return client;
}
 
開發者ID:Lambda-3,項目名稱:Stargraph,代碼行數:21,代碼來源:ElasticClient.java

示例2: DataParams

import com.typesafe.config.Config; //導入方法依賴的package包/類
public DataParams(Config config, String prefix) {
    train = new Train(config, prefix + KEY);
    test = new Test(config, prefix + KEY);
    delim = new Delim(config, prefix + KEY);
    y_sampling = config.getStringList(prefix + KEY + "y_sampling");

    assigned = config.getBoolean(prefix + KEY + "assigned");
    unassigned_mode = UnassignedMode.getMode(config.getString(prefix + KEY + "unassigned_mode"));

    for (String s : y_sampling) {
        CheckUtils.check(s.matches("\\[email protected](-?\\d+)(\\.\\d+)?"),
                "%sy_sampling:%s must be the format of [email protected] e.g [email protected]#0.1",
                prefix + KEY, s);
    }

    CheckUtils.check(unassigned_mode != UnassignedMode.UNKNOWN,
            "unknown %sunassigned_mode:%s, only support:%s",
            prefix + KEY, unassigned_mode.toString(), UnassignedMode.allToString());

}
 
開發者ID:yuantiku,項目名稱:ytk-learn,代碼行數:21,代碼來源:DataParams.java

示例3: LossParams

import com.typesafe.config.Config; //導入方法依賴的package包/類
public LossParams(Config config, String prefix) {
    loss_function = config.getString(prefix + KEY + "loss_function");
    regularization = new Regularization(config, prefix + KEY);
    evaluate_metric = config.getStringList(prefix + KEY + "evaluate_metric");
    just_evaluate = config.getBoolean(prefix + KEY + "just_evaluate");

    for (String metric : evaluate_metric) {
        if (!EvaluatorFactory.EvalNameSet.contains(metric)) {
            boolean hit = false;
            for (String eval : EvaluatorFactory.EvalNameSet) {
                if (metric.startsWith(eval)) {
                    hit = true;
                }
            }
            CheckUtils.check(hit, "%sevaluate_metric:%s, only support:%s",
                    prefix + KEY, metric, EvaluatorFactory.EvalNameSet);
        }
    }

}
 
開發者ID:yuantiku,項目名稱:ytk-learn,代碼行數:21,代碼來源:LossParams.java

示例4: getRpcModules

import com.typesafe.config.Config; //導入方法依賴的package包/類
public List<ModuleDescription> getRpcModules() {
    if (this.moduleDescriptions != null) {
        return this.moduleDescriptions;
    }

    List<ModuleDescription> modules = new ArrayList<>();

    if (!configFromFiles.hasPath("rpc.modules")) {
        return modules;
    }

    List<? extends ConfigObject> list = configFromFiles.getObjectList("rpc.modules");

    for (ConfigObject configObject : list) {
        Config configElement = configObject.toConfig();
        String name = configElement.getString("name");
        String version = configElement.getString("version");
        boolean enabled = configElement.getBoolean("enabled");
        List<String> enabledMethods = null;
        List<String> disabledMethods = null;

        if (configElement.hasPath("methods.enabled")) {
            enabledMethods = configElement.getStringList("methods.enabled");
        }

        if (configElement.hasPath("methods.disabled")) {
            disabledMethods = configElement.getStringList("methods.disabled");
        }

        modules.add(new ModuleDescription(name, version, enabled, enabledMethods, disabledMethods));
    }

    this.moduleDescriptions = modules;

    return modules;
}
 
開發者ID:rsksmart,項目名稱:rskj,代碼行數:37,代碼來源:RskSystemProperties.java

示例5: main

import com.typesafe.config.Config; //導入方法依賴的package包/類
public static void main(String[] args) {
    // {{start:resource}}
    Config defaultConfig = ConfigFactory.parseResources("defaults.conf");
    // {{end:resource}}

    // {{start:fallback}}
    Config fallbackConfig = ConfigFactory.parseResources("overrides.conf")
                                         .withFallback(defaultConfig)
                                         .resolve();
    // {{end:fallback}}

    // {{start:text}}
    log.info("name: {}", defaultConfig.getString("conf.name"));
    log.info("name: {}", fallbackConfig.getString("conf.name"));
    log.info("title: {}", defaultConfig.getString("conf.title"));
    log.info("title: {}", fallbackConfig.getString("conf.title"));
    // {{end:text}}

    // {{start:resolved}}
    log.info("combined: {}", fallbackConfig.getString("conf.combined"));
    // {{end:resolved}}

    // {{start:durations}}
    log.info("redis.ttl minutes: {}", fallbackConfig.getDuration("redis.ttl", TimeUnit.MINUTES));
    log.info("redis.ttl seconds: {}", fallbackConfig.getDuration("redis.ttl", TimeUnit.SECONDS));
    // {{end:durations}}

    // {{start:memorySize}}
    // Any path in the configuration can be treated as a separate Config object.
    Config uploadService = fallbackConfig.getConfig("uploadService");
    log.info("maxChunkSize bytes: {}", uploadService.getMemorySize("maxChunkSize").toBytes());
    log.info("maxFileSize bytes: {}", uploadService.getMemorySize("maxFileSize").toBytes());
    // {{end:memorySize}}

    // {{start:whitelist}}
    List<Integer> whiteList = fallbackConfig.getIntList("conf.nested.whitelistIds");
    log.info("whitelist: {}", whiteList);
    List<String> whiteListStrings = fallbackConfig.getStringList("conf.nested.whitelistIds");
    log.info("whitelist as Strings: {}", whiteListStrings);
    // {{end:whitelist}}


    // {{start:booleans}}
    log.info("yes: {}", fallbackConfig.getBoolean("featureFlags.featureA"));
    log.info("true: {}", fallbackConfig.getBoolean("featureFlags.featureB"));
    // {{end:booleans}}
}
 
開發者ID:StubbornJava,項目名稱:StubbornJava,代碼行數:48,代碼來源:TypesafeConfigExamples.java

示例6: getOptionalStringList

import com.typesafe.config.Config; //導入方法依賴的package包/類
/**
 * @param config configuration to query for value
 * @param key configuration path key
 * @return value for given key, or {@code null} if none exists
 */
public static List<String> getOptionalStringList(Config config, String key) {
  return config.hasPath(key) ? config.getStringList(key) : null;
}
 
開發者ID:oncewang,項目名稱:oryx2,代碼行數:9,代碼來源:ConfigUtils.java


注:本文中的com.typesafe.config.Config.getStringList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。