/** * 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); }
@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)); } }
private String process(final Env env, final String src) { return env.resolver() .delimiters(startDelimiter, endDelimiter) .source(key -> process(env, file(key))) .ignoreMissing() .resolve(src); }
/** * 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); }
@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)); } }
private String process(final Env env, final String src) { return env.resolver() .delimiters(startDelimiter, endDelimiter) .source(key -> process(env, file(key))) .ignoreMissing() .resolve(src); }