Skip to content

Commit 83349ec

Browse files
committed
add parseApplicationReplacement overrides
1 parent 1428ebb commit 83349ec

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

config/src/main/java/com/typesafe/config/ConfigFactory.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,29 @@ public static Config parseResourcesAnySyntax(String resourceBasename) {
10951095
/**
10961096
* Parse only any application replacement (specified by one of config.{resource,file,url}), returning
10971097
* an empty Config if no overrides were set.
1098+
*
1099+
* @return a {@link java.util.Optional} containing any specified replacement, or {@link Optional#empty()}
1100+
* if none was specified.
1101+
*/
1102+
public static java.util.Optional<Config> parseApplicationReplacement() {
1103+
return parseApplicationReplacement(ConfigParseOptions.defaults());
1104+
}
1105+
1106+
/**
1107+
* Like {@link #parseApplicationReplacement()} but allows you to specify a class loader
1108+
* ti yse rather than the current context class loader.
1109+
*
1110+
* @param loader the class loader
1111+
* @return a {@link java.util.Optional} containing any specified replacement, or {@link Optional#empty()}
1112+
* if none was specified.
1113+
*/
1114+
public static java.util.Optional<Config> parseApplicationReplacement(ClassLoader loader) {
1115+
return parseApplicationReplacement(ConfigParseOptions.defaults().setClassLoader(loader));
1116+
}
1117+
1118+
/**
1119+
* Like {@link #parseApplicationReplacement()} but allows you to specify parse options.
1120+
*
10981121
* @param parseOptions parse options
10991122
* @return a {@link java.util.Optional} containing any specified replacement, or {@link Optional#empty()}
11001123
* if none was specified.

0 commit comments

Comments
 (0)