当前位置: 首页>>代码示例>>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;未经允许,请勿转载。