yangxk1 commented on PR #739:
URL:
https://github.com/apache/incubator-graphar/pull/739#issuecomment-3248502158
I plan to refactor java-info `YamlLoader` as soon as possible.
For loader: Instead of abstracting away the GraphInfoLoader interface, we
can put the interface abstraction into the lower level YamlLoader
```
public class GraphInfoLoader {
public static GraphInfo load(String graphYamlPath, YamlReader
yamlReader) throws IOException {
final Path path = FileSystems.getDefault().getPath(graphYamlPath);
// load graph itself
String yaml = yamlReader.readYaml(graphYamlPath);
Yaml GraphYamlLoader = new Yaml(new Constructor(GraphYaml.class, new
LoaderOptions()));
GraphYaml graphYaml = GraphYamlLoader.load(yaml);
...
}
}
```
interface YamlLoader is used to handle io, e.g.
```
public class LocalFileSystemYamlLoader implements YamlReader{
String readYaml(String path) throws IOException{
return java.nio.file.Files.readString(Path.of(path));
}
}
```
For Saver:
Do we still need to provide this interface? we can only provide `String
dump()`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]