org.jooby.Env.resolver()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中org.jooby.Env.resolver()方法的一些代码示例,展示了Env.resolver()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Env.resolver()方法的具体详情如下:
包路径:org.jooby.Env
类名称:Env
方法名:resolver

Env.resolver介绍

[英]Creates a new environment Resolver.
[中]创建一个新的环境解析器。

代码示例

代码示例来源:origin: jooby-project/jooby

/**
 * Returns a string with all substitutions (the <code>${foo.bar}</code> syntax,
 * see <a href="https://github.com/typesafehub/config/blob/master/HOCON.md">the
 * spec</a>) resolved. Substitutions are looked up using the {@link #config()} as the root object,
 * that is, a substitution <code>${foo.bar}</code> will be replaced with
 * the result of <code>getValue("foo.bar")</code>.
 *
 * @param text Text to process.
 * @return A processed string.
 */
@Nonnull
default String resolve(final String text) {
 return resolver().resolve(text);
}

代码示例来源:origin: jooby-project/jooby

@Override
public String process(final String filename, final String source, final Config conf,
  final ClassLoader loader) {
 try {
  Env env = Env.DEFAULT.build(conf);
  List<String> delims = get("delims");
  Resolver resolver = env.resolver();
  boolean ignoreMissing = get("ignoreMissing");
  if (ignoreMissing) {
   resolver.ignoreMissing();
  }
  resolver.delimiters(delims.get(0), delims.get(1));
  return resolver.resolve(source);
 } catch (Exception cause) {
  int line = -1;
  int column = -1;
  Matcher matcher = POS.matcher(cause.getMessage());
  if (matcher.find()) {
   line = Integer.parseInt(matcher.group(1));
   column = Integer.parseInt(matcher.group(2));
  }
  throw new AssetException(name(),
    new AssetProblem(filename, line, column, cause.getMessage(), null));
 }
}

代码示例来源:origin: jooby-project/jooby

private String process(final Env env, final String src) {
 return env.resolver()
   .delimiters(startDelimiter, endDelimiter)
   .source(key -> process(env, file(key)))
   .ignoreMissing()
   .resolve(src);
}

代码示例来源:origin: org.jooby/jooby

/**
 * Returns a string with all substitutions (the <code>${foo.bar}</code> syntax,
 * see <a href="https://github.com/typesafehub/config/blob/master/HOCON.md">the
 * spec</a>) resolved. Substitutions are looked up using the {@link #config()} as the root object,
 * that is, a substitution <code>${foo.bar}</code> will be replaced with
 * the result of <code>getValue("foo.bar")</code>.
 *
 * @param text Text to process.
 * @return A processed string.
 */
@Nonnull
default String resolve(final String text) {
 return resolver().resolve(text);
}

代码示例来源:origin: org.jooby/jooby-assets

@Override
public String process(final String filename, final String source, final Config conf,
  final ClassLoader loader) {
 try {
  Env env = Env.DEFAULT.build(conf);
  List<String> delims = get("delims");
  Resolver resolver = env.resolver();
  boolean ignoreMissing = get("ignoreMissing");
  if (ignoreMissing) {
   resolver.ignoreMissing();
  }
  resolver.delimiters(delims.get(0), delims.get(1));
  return resolver.resolve(source);
 } catch (Exception cause) {
  int line = -1;
  int column = -1;
  Matcher matcher = POS.matcher(cause.getMessage());
  if (matcher.find()) {
   line = Integer.parseInt(matcher.group(1));
   column = Integer.parseInt(matcher.group(2));
  }
  throw new AssetException(name(),
    new AssetProblem(filename, line, column, cause.getMessage(), null));
 }
}

代码示例来源:origin: org.jooby/jooby

private String process(final Env env, final String src) {
 return env.resolver()
   .delimiters(startDelimiter, endDelimiter)
   .source(key -> process(env, file(key)))
   .ignoreMissing()
   .resolve(src);
}

相关文章