@@ -52,51 +52,3 @@ public static Map<String, Object> parse(String filePath) throws IOException {
5252 return objectMapper .readValue (new File (filePath ), new TypeReference <Map <String , Object >>() { });
5353 }
5454}
55-
56-
57-
58-
59-
60- //package hexlet.code;
61- //
62- //import com.fasterxml.jackson.core.type.TypeReference;
63- //import com.fasterxml.jackson.databind.ObjectMapper;
64- //import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
65- //
66- //import java.io.File;
67- //import java.io.IOException;
68- //import java.net.URISyntaxException;
69- //import java.nio.file.Path;
70- //import java.nio.file.Paths;
71- //import java.util.Map;
72- //import java.util.Objects;
73- //
74- //public class Parser {
75- //
76- // public static Map<String, Object> parse(String filePath) throws IOException {
77- // ObjectMapper objectMapper;
78- //
79- // if (filePath.endsWith(".json")) {
80- // objectMapper = new ObjectMapper();
81- // } else if (filePath.endsWith(".yaml") || filePath.endsWith(".yml")) {
82- // objectMapper = new ObjectMapper(new YAMLFactory()); // Используем YAML парсер
83- // } else {
84- // throw new IllegalArgumentException("Unsupported file format: " + filePath);
85- // }
86- //
87- // Path path;
88- // try {
89- // path = Paths.get(Objects.requireNonNull(
90- // Parser.class.getClassLoader().getResource("fixtures/" + filePath)).toURI());
91- // } catch (URISyntaxException e) {
92- // throw new RuntimeException("Invalid file path: " + filePath, e);
93- // }
94- //
95- // return objectMapper.readValue(path.toFile(), new TypeReference<Map<String, Object>>() {});
96- // }
97- //}
98-
99-
100-
101- // return objectMapper.readValue(new File("src/main/resources/fixtures/" + filePath),
102- // new TypeReference<Map<String, Object>>() { });
0 commit comments