@Override public SimpleConfig resolve(ConfigResolveOptions options) { AbstractConfigValue resolved = ResolveContext.resolve(object, object, options); if (resolved == object) return this; else return new SimpleConfig((AbstractConfigObject) resolved); }
/** * Conceptually, this is key.value().resolveSubstitutions() but using the replacement for * key.value() if any. */ AbstractConfigValue resolveCheckingReplacement( ResolveContext context, AbstractConfigValue original) throws NotPossibleToResolve { AbstractConfigValue replacement; replacement = replacement(context, original); if (replacement != original) { // start over, checking if replacement was memoized return context.resolve(replacement); } else { AbstractConfigValue resolved; resolved = original.resolveSubstitutions(context); return resolved; } }
AbstractConfigValue lookupSubst( ResolveContext context, SubstitutionExpression subst, int prefixLength) throws NotPossibleToResolve { context.trace(subst); try { // First we look up the full path, which means relative to the // included file if we were not a root file AbstractConfigValue result = findInObject(root, context, subst); if (result == null) { // Then we want to check relative to the root file. We don't // want the prefix we were included at to be used when looking // up env variables either. SubstitutionExpression unprefixed = subst.changePath(subst.path().subPath(prefixLength)); // replace the debug trace path context.untrace(); context.trace(unprefixed); if (prefixLength > 0) { result = findInObject(root, context, unprefixed); } if (result == null && context.options().getUseSystemEnvironment()) { result = findInObject(ConfigImpl.envVariablesAsConfigObject(), context, unprefixed); } } if (result != null) { result = context.resolve(result); } return result; } finally { context.untrace(); } }