当前位置: 首页>>代码示例>>Java>>正文


Java Toml.getString方法代码示例

本文整理汇总了Java中com.moandjiezana.toml.Toml.getString方法的典型用法代码示例。如果您正苦于以下问题:Java Toml.getString方法的具体用法?Java Toml.getString怎么用?Java Toml.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.moandjiezana.toml.Toml的用法示例。


在下文中一共展示了Toml.getString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addConfigurations

import com.moandjiezana.toml.Toml; //导入方法依赖的package包/类
/**
 * Register a new configuration file containing Talon parameters. These parameter objects will be
 * merged with existing parameter objects. If a new parameter object has the same name as an
 * existing object, the old object will be overwritten.
 *
 * @param configs a parsed config collection
 */
public void addConfigurations(Toml configs) {
  List<Toml> configList = configs.getTables(TALON_TABLE);
  if (configList == null) {
    logger.error("no " + TALON_TABLE + " tables in config");
    return;
  }

  for (Toml config : configList) {
    String name = config.getString(TalonConfigurationBuilder.NAME);
    if (name == null) {
      throw new IllegalArgumentException(TALON_TABLE + " configuration name parameter missing");
    }
    settings.put(name, TalonConfigurationBuilder.create(config));
    logger.info("added configuration: {}", name);
  }
}
 
开发者ID:strykeforce,项目名称:thirdcoast,代码行数:24,代码来源:TalonProvisioner.java

示例2: Configurator

import com.moandjiezana.toml.Toml; //导入方法依赖的package包/类
public Configurator() {

        if (Files.exists(Paths.get(CONFIG_FILE))) {
            Toml toml = new Toml();
            toml.parse(new File(CONFIG_FILE));
            siteName = toml.getString(SITE_NAME.key);
            siteTagline = toml.getString(SITE_TAGLINE.key);
            siteAuthor = toml.getString(SITE_AUTHOR.key);
            siteBaseUrl = toml.getString(SITE_BASE_URL.key);
            sourceDir = toml.getString(SOURCE_DIR.key);
            outputDir = toml.getString(OUTPUT_DIR.key);
            excludeDirs = toml.getList(EXCLUDE.key);
            inputDateFormat = toml.getString(IN_DATE_FORMAT.key);
            outputDateFormat = toml.getString(OUT_DATE_FORMAT.key);
            theme = toml.getString(THEME.key);
            indexPosts = Integer.valueOf(toml.getLong(INDEX_POSTS.key).toString());
            port = Integer.valueOf(toml.getLong(PORT.key).toString());
            Map<String, Object> socialLinks = toml.getTable(SOCIAL.key).to(Map.class);
            social = new Social(socialLinks);
            renderTags = toml.getBoolean(RENDER_TAGS.key);
            headerImage = toml.getString(IMAGE.key);
        }
        if (this.siteBaseUrl != null && this.siteBaseUrl.contains("localhost")) {
            this.siteBaseUrl = "http://localhost:" + port;
        }
    }
 
开发者ID:pawandubey,项目名称:griffin,代码行数:27,代码来源:Configurator.java

示例3: parse

import com.moandjiezana.toml.Toml; //导入方法依赖的package包/类
@Override
public void parse(Reader source, Toml data) throws Exception {
	for (Toml toml : data.getTables("parser")) {
		String path = toml.getString("path");
		String name = toml.getString("name");

		@SuppressWarnings("unchecked")
		Class<Parser<?, ?>> clazz = (Class<Parser<?, ?>>) Class.forName(name);
		Parser<?, ?> parser = find(clazz, path);

		context.addParser(clazz, parser);
		parser.parse();
	}
}
 
开发者ID:atomicint,项目名称:brandywine,代码行数:15,代码来源:ParserTomlParser.java

示例4: getMode

import com.moandjiezana.toml.Toml; //导入方法依赖的package包/类
static CANTalon.TalonControlMode getMode(Toml config) {
  String mode = config.getString(MODE);
  if (mode == null) {
    throw new IllegalArgumentException("mode missing from configuration");
  }
  return CANTalon.TalonControlMode.valueOf(mode);
}
 
开发者ID:strykeforce,项目名称:thirdcoast,代码行数:8,代码来源:TalonConfigurationBuilder.java

示例5: createTargetDirIfNeeded

import com.moandjiezana.toml.Toml; //导入方法依赖的package包/类
public void createTargetDirIfNeeded(File tomlFile, boolean mkdirs) {
    Toml toml = new Toml().read(tomlFile);
    String dest = toml.getString("template.dest");
    File destFile = new File(dest);
    if (mkdirs) {
        destFile.getParentFile().mkdirs();
    }
}
 
开发者ID:nodevops,项目名称:confd-maven-plugin,代码行数:9,代码来源:LocalConfdProcessorImpl.java

示例6: processToml

import com.moandjiezana.toml.Toml; //导入方法依赖的package包/类
private List<String> processToml(
    File tomlFile,
    File templatesDirectory,
    Map<String, String> env,
    String encoding,
    boolean mkdirs
) throws IOException {
    Toml toml = new Toml().read(tomlFile);
    String src = toml.getString("template.src");
    String dest = toml.getString("template.dest");
    List<String> keys = toml.getList("template.keys");

    if (keys == null || keys.size() == 0) {
        throw new IOException("Something went wrong while processing the toml file <" + tomlFile +
            ">: the 'keys' section must exist and contain at least one key");
    }

    // filter the env map according to the keys defined in the toml
    HashMap<String, String> filteredEnv = new HashMap<String, String>();
    for (Map.Entry<String, String> entry : env.entrySet()) {
        for (String key : keys) {
            if (entry.getKey().startsWith(key)) {
                filteredEnv.put(entry.getKey(), entry.getValue());
            }
        }
    }
    File templateFile = new File(templatesDirectory, src);
    File destFile = new File(dest);
    if (mkdirs) {
        destFile.getParentFile().mkdirs();
    }
    Parser parser = new Parser(templateFile, encoding);
    String parsedTemplate = parser.parse(filteredEnv);
    FileUtils.fileWrite(destFile, encoding, parsedTemplate);
    return parser.getTemplateKeys();
}
 
开发者ID:nodevops,项目名称:confd-maven-plugin,代码行数:37,代码来源:JavaProcessorImpl.java


注:本文中的com.moandjiezana.toml.Toml.getString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。