Remove code duplication (returns in conf classes)
This commit is contained in:
parent
5766072fd7
commit
54b7b9a695
3 changed files with 27 additions and 29 deletions
|
@ -67,16 +67,15 @@ public final class EngineConfiguration extends Configuration {
|
|||
private static EngineConfiguration instance;
|
||||
|
||||
/**
|
||||
* Contains the group in which setting overrides must begin with..
|
||||
* Contains prefix properties must begin with.
|
||||
*
|
||||
* @since v1-alpha0
|
||||
* -- GETTER --
|
||||
* Returns the group in which setting overrides must begin with.
|
||||
* Returns prefix properties must begin with.
|
||||
*
|
||||
* @return property group
|
||||
* @since v1-alpha0
|
||||
*/
|
||||
@Getter
|
||||
private final @NotNull String group = "sosengine.base.";
|
||||
|
||||
/**
|
||||
|
@ -391,26 +390,26 @@ public final class EngineConfiguration extends Configuration {
|
|||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public @Nullable Object getSetting(@NotNull String setting) {
|
||||
switch (setting) {
|
||||
case "debug" -> { return debug; }
|
||||
case "debugEvents" -> { return debugEvents; }
|
||||
case "debugShortcodeConverter" -> { return debugShortcodeConverter; }
|
||||
return switch (setting) {
|
||||
case "debug" -> debug;
|
||||
case "debugEvents" -> debugEvents;
|
||||
case "debugShortcodeConverter" -> debugShortcodeConverter;
|
||||
|
||||
case "errorShortcodeConverter" -> { return errorShortcodeConverter; }
|
||||
case "errorShortcodeConverter" -> errorShortcodeConverter;
|
||||
|
||||
case "optimizeLogging" -> { return optimizeLogging; }
|
||||
case "optimizeEvents" -> { return optimizeEvents; }
|
||||
case "optimizeSubsystemInitialization" -> { return optimizeSubsystemInitialization; }
|
||||
case "optimizeLogging" -> optimizeLogging;
|
||||
case "optimizeEvents" -> optimizeEvents;
|
||||
case "optimizeSubsystemInitialization" -> optimizeSubsystemInitialization;
|
||||
|
||||
case "loggerLevel" -> { return loggerLevel; }
|
||||
case "loggerTemplate" -> { return loggerTemplate; }
|
||||
case "loggerPollingSpeed" -> { return loggerPollingSpeed; }
|
||||
case "loggerForceStandardOutput" -> { return loggerForceStandardOutput; }
|
||||
case "loggerEnableNewlineSupport" -> { return loggerEnableNewlineSupport; }
|
||||
case "loggerImmediateShutdown" -> { return loggerImmediateShutdown; }
|
||||
case "loggerLevel" -> loggerLevel;
|
||||
case "loggerTemplate" -> loggerTemplate;
|
||||
case "loggerPollingSpeed" -> loggerPollingSpeed;
|
||||
case "loggerForceStandardOutput" -> loggerForceStandardOutput;
|
||||
case "loggerEnableNewlineSupport" -> loggerEnableNewlineSupport;
|
||||
case "loggerImmediateShutdown" -> loggerImmediateShutdown;
|
||||
|
||||
case "hideFullTypePath" -> { return hideFullTypePath; }
|
||||
default -> { return null; }
|
||||
}
|
||||
case "hideFullTypePath" -> hideFullTypePath;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ public abstract class Configuration {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the group in which setting overrides must begin with.
|
||||
* Returns prefix properties must begin with.
|
||||
*
|
||||
* @return property group
|
||||
* @since v1-alpha2
|
||||
|
|
|
@ -48,16 +48,15 @@ public final class GlfwSubsystemConfiguration extends Configuration {
|
|||
private static GlfwSubsystemConfiguration instance;
|
||||
|
||||
/**
|
||||
* Defines the group in which setting overrides must begin with.
|
||||
* Defines prefix properties must begin with.
|
||||
*
|
||||
* @since v1-alpha0
|
||||
* -- GETTER --
|
||||
* Returns the group in which setting overrides must begin with.
|
||||
* Returns prefix properties must begin with.
|
||||
*
|
||||
* @return property group
|
||||
* @since v1-alpha0
|
||||
*/
|
||||
@Getter
|
||||
private final @NotNull String group = "sosengine.windowing.glfw.";
|
||||
|
||||
/**
|
||||
|
@ -136,10 +135,10 @@ public final class GlfwSubsystemConfiguration extends Configuration {
|
|||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public @Nullable Object getSetting(@NotNull String setting) {
|
||||
switch (setting) {
|
||||
case "platform" -> { return platform; }
|
||||
case "disableLibdecor" -> { return disableLibdecor; }
|
||||
default -> { return null; }
|
||||
}
|
||||
return switch (setting) {
|
||||
case "platform" -> platform;
|
||||
case "disableLibdecor" -> disableLibdecor;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue