Skip to content

Commit 0941430

Browse files
committed
delete class Parser
1 parent a17da68 commit 0941430

File tree

5 files changed

+5
-84
lines changed

5 files changed

+5
-84
lines changed

app/src/main/java/hexlet/code/source/Differ.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package hexlet.code.source;
22

3+
import com.fasterxml.jackson.databind.ObjectMapper;
4+
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
35
import hexlet.code.Formatter;
4-
import hexlet.code.source.parsers.Parser;
5-
import hexlet.code.source.parsers.ParserJson;
6-
import hexlet.code.source.parsers.ParserYAML;
76

87
import java.io.FileNotFoundException;
98
import java.io.IOException;
@@ -33,9 +32,9 @@ public static String generate(String filePath1, String filePath2, String format)
3332
throw new FileNotFoundException("Файл для чтения не найден");
3433
}
3534

36-
Parser parser = (FileManager.isJsonFile(normalizedPath1)) ? new ParserJson() : new ParserYAML();
37-
var dataFirst = parser.parsFile(normalizedPath1);
38-
var dataSecond = parser.parsFile(normalizedPath2);
35+
ObjectMapper mapper = (FileManager.isJsonFile(normalizedPath1)) ? new ObjectMapper() : new YAMLMapper();
36+
var dataFirst = mapper.readValue(normalizedPath1.toFile(), Map.class);
37+
var dataSecond = mapper.readValue(normalizedPath2.toFile(), Map.class);
3938

4039

4140

app/src/main/java/hexlet/code/source/parsers/Parser.java

Lines changed: 0 additions & 9 deletions
This file was deleted.

app/src/main/java/hexlet/code/source/parsers/ParserJson.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/src/main/java/hexlet/code/source/parsers/ParserYAML.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/src/test/java/source/TestParsers.java

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)