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; package com.rusefi.pinout;
import java.io.FileNotFoundException; import java.io.*;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.util.List; import java.util.List;
public interface BoardInputs { public interface BoardInputs {
List<?> getBoardYamlKeys(); List<? extends File> getBoardYamlKeys();
Reader getReader(Object yamlKey) throws FileNotFoundException; Reader getReader(File yamlKey) throws FileNotFoundException;
String getName(); String getName();

View File

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

View File

@ -225,7 +225,7 @@ public class PinoutLogic {
} }
private void readFiles() throws IOException { 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"); header.append("// auto-generated by PinoutLogic.java based on " + yamlFile + "\n");
readMetaInfo(yamlFile.toString(), boardInputs.getReader(yamlFile)); readMetaInfo(yamlFile.toString(), boardInputs.getReader(yamlFile));
} }

View File

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