feat(hw-02): implement student and book stream processing
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.example;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
public final class StudentReader {
|
||||
|
||||
public static List<Student> read(Path path) throws IOException {
|
||||
return MAPPER.readValue(path.toFile(), new TypeReference<List<Student>>() {});
|
||||
}
|
||||
|
||||
private StudentReader() {}
|
||||
|
||||
private static final ObjectMapper MAPPER =
|
||||
new ObjectMapper().registerModule(new JavaTimeModule());
|
||||
}
|
||||
Reference in New Issue
Block a user