refactoring
This commit is contained in:
parent
56fbc21b71
commit
843f759941
Binary file not shown.
|
@ -35,9 +35,4 @@ public class CHeaderConsumer implements ConfigurationConsumer {
|
|||
public void handleEndStruct(ConfigStructure structure) throws IOException {
|
||||
ConfigStructure.headerWrite(structure, cHeader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTotalEnd() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,11 +55,10 @@ public class ConfigDefinition {
|
|||
|
||||
ConfigurationConsumer cHeaderConsumer = new CHeaderConsumer(cHeader);
|
||||
ConfigurationConsumer tsProjectConsumer = new TSProjectConsumer(tsWriter, tsPath, state);
|
||||
ConfigurationConsumer javaFieldsConcumer = new JavaFieldsConsumer(javaFieldsWriter, state);
|
||||
ConfigurationConsumer javaFieldsConsumer = new JavaFieldsConsumer(javaFieldsWriter, state, javaConsolePath);
|
||||
|
||||
processFile(state, br, cHeaderConsumer, tsProjectConsumer, javaFieldsConcumer);
|
||||
processFile(state, br, cHeaderConsumer, tsProjectConsumer, javaFieldsConsumer);
|
||||
|
||||
JavaFieldsConsumer.writeFields(javaConsolePath, javaFieldsWriter);
|
||||
|
||||
|
||||
TSProjectConsumer.writeTunerStudioFile(tsPath, tsWriter.toString());
|
||||
|
@ -136,6 +135,7 @@ public class ConfigDefinition {
|
|||
}
|
||||
}
|
||||
cHeaderConsumer.endFile();
|
||||
javaFieldsConcumer.endFile();
|
||||
}
|
||||
|
||||
private static void handleCustomLine(ReaderState state, String line) {
|
||||
|
|
|
@ -8,6 +8,4 @@ public interface ConfigurationConsumer {
|
|||
void endFile() throws IOException;
|
||||
|
||||
void handleEndStruct(ConfigStructure structure) throws IOException;
|
||||
|
||||
void onTotalEnd();
|
||||
}
|
||||
|
|
|
@ -7,13 +7,15 @@ public class JavaFieldsConsumer implements ConfigurationConsumer {
|
|||
|
||||
private final CharArrayWriter javaFieldsWriter;
|
||||
private final ReaderState state;
|
||||
private final String javaConsolePath;
|
||||
|
||||
public JavaFieldsConsumer(CharArrayWriter javaFieldsWriter, ReaderState state) {
|
||||
public JavaFieldsConsumer(CharArrayWriter javaFieldsWriter, ReaderState state, String javaConsolePath) {
|
||||
this.javaFieldsWriter = javaFieldsWriter;
|
||||
this.state = state;
|
||||
this.javaConsolePath = javaConsolePath;
|
||||
}
|
||||
|
||||
static void writeFields(String javaConsolePath, CharArrayWriter javaFieldsWriter) throws IOException {
|
||||
private static void writeFields(String javaConsolePath, CharArrayWriter javaFieldsWriter) throws IOException {
|
||||
BufferedWriter javaFields = new BufferedWriter(new FileWriter(javaConsolePath + File.separator + FIELDS_JAVA));
|
||||
javaFields.write("package com.rusefi.config;" + ConfigDefinition.EOL + ConfigDefinition.EOL);
|
||||
javaFields.write("// this file " + ConfigDefinition.MESSAGE + ConfigDefinition.EOL);
|
||||
|
@ -31,7 +33,7 @@ public class JavaFieldsConsumer implements ConfigurationConsumer {
|
|||
|
||||
@Override
|
||||
public void endFile() throws IOException {
|
||||
|
||||
JavaFieldsConsumer.writeFields(javaConsolePath, javaFieldsWriter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,9 +42,4 @@ public class JavaFieldsConsumer implements ConfigurationConsumer {
|
|||
structure.writeJavaFields(state,"", javaFieldsWriter, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTotalEnd() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,9 +89,4 @@ public class TSProjectConsumer implements ConfigurationConsumer {
|
|||
// TSProjectConsumer.writeTunerStudioFile(tsPath, tsWriter.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTotalEnd() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue