MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / JsonConfig

Class JsonConfig

java/src/org/openqa/selenium/grid/config/JsonConfig.java:33–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31import org.openqa.selenium.json.JsonException;
32
33public class JsonConfig implements Config {
34
35 private static final Json JSON = new Json();
36 private final Config delegate;
37
38 JsonConfig(Reader reader) {
39 try {
40 delegate = new MapConfig(JSON.toType(Require.nonNull("JSON source", reader), MAP_TYPE));
41 } catch (JsonException e) {
42 throw new ConfigException("Unable to parse input", e);
43 }
44 }
45
46 public static Config from(Path path) {
47 try (Reader reader = Files.newBufferedReader(path)) {
48 return new JsonConfig(reader);
49 } catch (IOException e) {
50 throw new ConfigException("Unable to read JSON.", e);
51 }
52 }
53
54 @Override
55 public Optional<List<String>> getAll(String section, String option) {
56 return delegate.getAll(section, option);
57 }
58
59 @Override
60 public Set<String> getSectionNames() {
61 return delegate.getSectionNames();
62 }
63
64 @Override
65 public Set<String> getOptions(String section) {
66 return delegate.getOptions(Require.nonNull("Section name to get options for", section));
67 }
68}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected