20: Make AlarmConfigurationParser return AlarmConfiguration
This commit is contained in:
@@ -9,7 +9,7 @@ import java.util.*;
|
|||||||
|
|
||||||
public final class AlarmConfigurationParser {
|
public final class AlarmConfigurationParser {
|
||||||
|
|
||||||
public static List<PriceAlarmDefinition> parse(Path path) throws IOException {
|
public static AlarmConfiguration parse(Path path) throws IOException {
|
||||||
List<String> lines = Files.readAllLines(path);
|
List<String> lines = Files.readAllLines(path);
|
||||||
List<PriceAlarmDefinition> alarms = new ArrayList<>();
|
List<PriceAlarmDefinition> alarms = new ArrayList<>();
|
||||||
Map<String, String> constants = new LinkedHashMap<>();
|
Map<String, String> constants = new LinkedHashMap<>();
|
||||||
@@ -40,7 +40,7 @@ public final class AlarmConfigurationParser {
|
|||||||
throw new IllegalArgumentException("No alarms found in " + path);
|
throw new IllegalArgumentException("No alarms found in " + path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return List.copyOf(alarms);
|
return new AlarmConfiguration(alarms, constants);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PriceAlarmDefinition parseLine(String line) {
|
static PriceAlarmDefinition parseLine(String line) {
|
||||||
|
|||||||
Reference in New Issue
Block a user