Add EngineConfiguration#getSetting()

This commit is contained in:
JeremyStar™ 2024-06-09 00:19:51 +02:00
parent db408d796d
commit 56d273aa39
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -25,6 +25,8 @@ import de.staropensource.sosengine.base.types.LogIssuer;
import de.staropensource.sosengine.base.types.LogLevel;
import de.staropensource.sosengine.base.utility.PropertyParser;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Properties;
@ -265,4 +267,40 @@ public class EngineConfiguration {
loggerImmediateShutdown = false;
loggerForceStandardOutput = false;
}
/**
* Returns a configuration setting.
*
* @param setting the setting name
* @return the setting's value or {@code null} if not found
*/
@Nullable
public Object getSetting(@NotNull String setting) {
switch (setting) {
case "debug" -> {
return debug;
}
case "debugShortcodeConverter" -> {
return debugShortcodeConverter;
}
case "errorShortcodeConverter" -> {
return errorShortcodeConverter;
}
case "loggerLevel" -> {
return loggerLevel;
}
case "loggerTemplate" -> {
return loggerTemplate;
}
case "loggerImmediateShutdown" -> {
return loggerImmediateShutdown;
}
case "loggerForceStandardOutput" -> {
return loggerForceStandardOutput;
}
default -> {
return null;
}
}
}
}