refactoring?

This commit is contained in:
rusefillc 2023-05-30 21:49:36 -04:00
parent 5e1168afc6
commit bc8b073a6f
1 changed files with 5 additions and 5 deletions

View File

@ -134,19 +134,19 @@ public class PinoutLogic {
}
@SuppressWarnings("unchecked")
private void readMetaInfo(String yamlName, Reader reader) {
private void readMetaInfo(File yamlFile, Reader reader) {
Yaml yaml = new Yaml();
Map<String, Object> yamlData = yaml.load(reader);
if (yamlData == null) {
SystemOut.println("Null yaml for " + yamlName);
SystemOut.println("Null yaml for " + yamlFile);
return;
}
List<Map<String, Object>> data = (List<Map<String, Object>>) yamlData.get("pins");
if (data == null) {
SystemOut.println("Null yaml for " + yamlName);
SystemOut.println("Null yaml for " + yamlFile);
return;
}
log.info("Got from " + yamlName + ": " + data);
log.info("Got from " + yamlFile + ": " + data);
Objects.requireNonNull(data, "data");
for (Map<String, Object> pin : data) {
Object pinId = pin.get("id");
@ -227,7 +227,7 @@ public class PinoutLogic {
private void readFiles() throws IOException {
for (File yamlFile : boardInputs.getBoardYamlKeys()) {
header.append("// auto-generated by PinoutLogic.java based on " + yamlFile + "\n");
readMetaInfo(yamlFile.toString(), boardInputs.getReader(yamlFile));
readMetaInfo(yamlFile, boardInputs.getReader(yamlFile));
}
log.info("Got from " + boardInputs.getBoardYamlKeys().size() + " file(s): " + this);
}