Simplify component model overrides

Fixes #9021
This commit is contained in:
Hynek Mlnarik 2021-12-06 15:56:39 +01:00 committed by Hynek Mlnařík
parent 4f66087bf4
commit 2785cab596
2 changed files with 11 additions and 7 deletions

View file

@ -119,4 +119,8 @@ public class ComponentModelScope implements Scope {
throw new UnsupportedOperationException("Not implemented");
}
public ComponentModel getComponentModel() {
return componentConfig;
}
}

View file

@ -85,22 +85,22 @@ public class ComponentModel implements Serializable {
}
public String get(String key, String defaultValue) {
String s = config.getFirst(key);
String s = get(key);
return s != null ? s : defaultValue;
}
public int get(String key, int defaultValue) {
String s = config.getFirst(key);
String s = get(key);
return s != null ? Integer.parseInt(s) : defaultValue;
}
public long get(String key, long defaultValue) {
String s = config.getFirst(key);
String s = get(key);
return s != null ? Long.parseLong(s) : defaultValue;
}
public boolean get(String key, boolean defaultValue) {
String s = config.getFirst(key);
String s = get(key);
return s != null ? Boolean.parseBoolean(s) : defaultValue;
}
@ -109,15 +109,15 @@ public class ComponentModel implements Serializable {
}
public void put(String key, int value) {
config.putSingle(key, Integer.toString(value));
put(key, Integer.toString(value));
}
public void put(String key, long value) {
config.putSingle(key, Long.toString(value));
put(key, Long.toString(value));
}
public void put(String key, boolean value) {
config.putSingle(key, Boolean.toString(value));
put(key, Boolean.toString(value));
}
public boolean hasNote(String key) {