refactoring?

This commit is contained in:
rusefillc 2023-05-30 21:40:23 -04:00
parent 9b007eb228
commit 5e1168afc6
4 changed files with 10 additions and 13 deletions

View File

@ -1,15 +1,12 @@
package com.rusefi.pinout;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.io.*;
import java.util.List;
public interface BoardInputs {
List<?> getBoardYamlKeys();
List<? extends File> getBoardYamlKeys();
Reader getReader(Object yamlKey) throws FileNotFoundException;
Reader getReader(File yamlKey) throws FileNotFoundException;
String getName();

View File

@ -32,13 +32,13 @@ public class FileSystemBoardInputsImpl implements BoardInputs {
}
@Override
public List<?> getBoardYamlKeys() {
public List<? extends File> getBoardYamlKeys() {
return boardYamlFiles;
}
@Override
public Reader getReader(Object yamlKey) throws FileNotFoundException {
return new FileReader((File)yamlKey);
public Reader getReader(File yamlKey) throws FileNotFoundException {
return new FileReader(yamlKey);
}
@Override

View File

@ -225,7 +225,7 @@ public class PinoutLogic {
}
private void readFiles() throws IOException {
for (Object yamlFile : boardInputs.getBoardYamlKeys()) {
for (File yamlFile : boardInputs.getBoardYamlKeys()) {
header.append("// auto-generated by PinoutLogic.java based on " + yamlFile + "\n");
readMetaInfo(yamlFile.toString(), boardInputs.getReader(yamlFile));
}

View File

@ -72,12 +72,12 @@ public class PinoutLogicIntegratedTest {
BoardInputs testBoard = new BoardInputs() {
@Override
public List<?> getBoardYamlKeys() {
return Collections.singletonList("key");
public List<? extends File> getBoardYamlKeys() {
return Collections.singletonList(new File("key"));
}
@Override
public Reader getReader(Object yamlKey) {
public Reader getReader(File yamlKey) {
return input;
}