Skip to content

Commit ffcd14f

Browse files
(fix): use a ParserSupplier instead of java.util.Supplier to enable work on older versions of Android. (#340)
* use a ParserSupplier to enable work on older versions of Android. * remove the generics
1 parent 6d95ea3 commit ffcd14f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

core-api/src/main/java/com/optimizely/ab/config/parser/DefaultConfigParser.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ public static ConfigParser getInstance() {
3838
}
3939

4040
//======== Helper methods ========//
41+
@FunctionalInterface
42+
public interface ParserSupplier {
43+
44+
/**
45+
* Gets a result.
46+
*
47+
* @return a result
48+
*/
49+
ConfigParser get();
50+
}
4151

4252
public enum ConfigParserSupplier {
4353
// WARNING THESE MUST REMAIN LAMBDAS!!!
@@ -49,9 +59,9 @@ public enum ConfigParserSupplier {
4959
JSON_SIMPLE_CONFIG_PARSER("org.json.simple.JSONObject", () -> { return new JsonSimpleConfigParser(); });
5060

5161
private final String className;
52-
private final Supplier<ConfigParser> supplier;
62+
private final ParserSupplier supplier;
5363

54-
ConfigParserSupplier(String className, Supplier<ConfigParser> supplier) {
64+
ConfigParserSupplier(String className, ParserSupplier supplier) {
5565
this.className = className;
5666
this.supplier = supplier;
5767
}

0 commit comments

Comments
 (0)