Remove code duplication (returns in conf classes)

This commit is contained in:
JeremyStar™ 2024-09-20 17:10:33 +02:00
parent 5766072fd7
commit 54b7b9a695
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
3 changed files with 27 additions and 29 deletions

View file

@ -67,16 +67,15 @@ public final class EngineConfiguration extends Configuration {
private static EngineConfiguration instance; private static EngineConfiguration instance;
/** /**
* Contains the group in which setting overrides must begin with.. * Contains prefix properties must begin with.
* *
* @since v1-alpha0 * @since v1-alpha0
* -- GETTER -- * -- GETTER --
* Returns the group in which setting overrides must begin with. * Returns prefix properties must begin with.
* *
* @return property group * @return property group
* @since v1-alpha0 * @since v1-alpha0
*/ */
@Getter
private final @NotNull String group = "sosengine.base."; private final @NotNull String group = "sosengine.base.";
/** /**
@ -391,26 +390,26 @@ public final class EngineConfiguration extends Configuration {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public @Nullable Object getSetting(@NotNull String setting) { public @Nullable Object getSetting(@NotNull String setting) {
switch (setting) { return switch (setting) {
case "debug" -> { return debug; } case "debug" -> debug;
case "debugEvents" -> { return debugEvents; } case "debugEvents" -> debugEvents;
case "debugShortcodeConverter" -> { return debugShortcodeConverter; } case "debugShortcodeConverter" -> debugShortcodeConverter;
case "errorShortcodeConverter" -> { return errorShortcodeConverter; } case "errorShortcodeConverter" -> errorShortcodeConverter;
case "optimizeLogging" -> { return optimizeLogging; } case "optimizeLogging" -> optimizeLogging;
case "optimizeEvents" -> { return optimizeEvents; } case "optimizeEvents" -> optimizeEvents;
case "optimizeSubsystemInitialization" -> { return optimizeSubsystemInitialization; } case "optimizeSubsystemInitialization" -> optimizeSubsystemInitialization;
case "loggerLevel" -> { return loggerLevel; } case "loggerLevel" -> loggerLevel;
case "loggerTemplate" -> { return loggerTemplate; } case "loggerTemplate" -> loggerTemplate;
case "loggerPollingSpeed" -> { return loggerPollingSpeed; } case "loggerPollingSpeed" -> loggerPollingSpeed;
case "loggerForceStandardOutput" -> { return loggerForceStandardOutput; } case "loggerForceStandardOutput" -> loggerForceStandardOutput;
case "loggerEnableNewlineSupport" -> { return loggerEnableNewlineSupport; } case "loggerEnableNewlineSupport" -> loggerEnableNewlineSupport;
case "loggerImmediateShutdown" -> { return loggerImmediateShutdown; } case "loggerImmediateShutdown" -> loggerImmediateShutdown;
case "hideFullTypePath" -> { return hideFullTypePath; } case "hideFullTypePath" -> hideFullTypePath;
default -> { return null; } default -> null;
} };
} }
} }

View file

@ -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 * @return property group
* @since v1-alpha2 * @since v1-alpha2

View file

@ -48,16 +48,15 @@ public final class GlfwSubsystemConfiguration extends Configuration {
private static GlfwSubsystemConfiguration instance; private static GlfwSubsystemConfiguration instance;
/** /**
* Defines the group in which setting overrides must begin with. * Defines prefix properties must begin with.
* *
* @since v1-alpha0 * @since v1-alpha0
* -- GETTER -- * -- GETTER --
* Returns the group in which setting overrides must begin with. * Returns prefix properties must begin with.
* *
* @return property group * @return property group
* @since v1-alpha0 * @since v1-alpha0
*/ */
@Getter
private final @NotNull String group = "sosengine.windowing.glfw."; private final @NotNull String group = "sosengine.windowing.glfw.";
/** /**
@ -136,10 +135,10 @@ public final class GlfwSubsystemConfiguration extends Configuration {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public @Nullable Object getSetting(@NotNull String setting) { public @Nullable Object getSetting(@NotNull String setting) {
switch (setting) { return switch (setting) {
case "platform" -> { return platform; } case "platform" -> platform;
case "disableLibdecor" -> { return disableLibdecor; } case "disableLibdecor" -> disableLibdecor;
default -> { return null; } default -> null;
} };
} }
} }