MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / from

Method from

java/src/org/openqa/selenium/grid/config/Configs.java:30–49  ·  view source on GitHub ↗
(Path path)

Source from the content-addressed store, hash-verified

28 }
29
30 public static Config from(Path path) {
31 Require.nonNull("Path to read from", path);
32
33 if (!Files.exists(path)) {
34 throw new ConfigException("Path to read from does not exist: " + path);
35 }
36
37 String fileName = path.getFileName().toString();
38 if (fileName.endsWith(".tml") || fileName.endsWith(".toml")) {
39 return TomlConfig.from(path);
40 }
41
42 if (fileName.endsWith(".json")) {
43 return JsonConfig.from(path);
44 }
45
46 throw new ConfigException(
47 "Unable to determine file type. The file extension must be one of '.toml' or '.json' "
48 + path);
49 }
50}

Callers

nothing calls this directly

Calls 5

nonNullMethod · 0.95
fromMethod · 0.95
fromMethod · 0.95
existsMethod · 0.80
toStringMethod · 0.65

Tested by

no test coverage detected