forked from StarOpenSource/Engine
Add hideFullTypePath engine setting
This commit is contained in:
parent
062b68a93b
commit
a07dc6db84
5 changed files with 46 additions and 4 deletions
|
@ -25,6 +25,7 @@ import de.staropensource.sosengine.base.logging.Logger;
|
|||
import de.staropensource.sosengine.base.types.CodePart;
|
||||
import de.staropensource.sosengine.base.types.logging.LogIssuer;
|
||||
import de.staropensource.sosengine.base.types.logging.LogLevel;
|
||||
import de.staropensource.sosengine.base.types.vectors.Vec2;
|
||||
import de.staropensource.sosengine.base.utility.converter.AnsiShortcodeConverter;
|
||||
import de.staropensource.sosengine.base.utility.parser.PropertyParser;
|
||||
import lombok.Getter;
|
||||
|
@ -273,6 +274,25 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
|||
*/
|
||||
private int loggerPollingSpeed;
|
||||
|
||||
/**
|
||||
* Will truncate the path of types when using their {@code toString} method.
|
||||
* <p>
|
||||
* Here's an example: Lets say that you have a {@link Vec2} and to convert it
|
||||
* to a String, which you can do with {@link Vec2#toString()}. With this flag disabled
|
||||
* it would return {@code de.staropensource.sosengine.base.types.vectors.Vec2(x=64 y=64)},
|
||||
* with it however it would be {@code Vec2(x=64 y=64)}, which is much smaller.
|
||||
*
|
||||
* @since v1-alpha2
|
||||
*
|
||||
* -- GETTER --
|
||||
* Gets the value for {@link #hideFullTypePath}.
|
||||
*
|
||||
* @return variable value
|
||||
* @see EngineConfiguration#hideFullTypePath
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
private boolean hideFullTypePath;
|
||||
|
||||
/**
|
||||
* Constructs this class.
|
||||
*
|
||||
|
@ -328,6 +348,8 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
|||
case "loggerImmediateShutdown" -> loggerImmediateShutdown = parser.getBoolean(group + property);
|
||||
case "loggerForceStandardOutput" -> loggerForceStandardOutput = parser.getBoolean(group + property);
|
||||
case "loggerPollingSpeed" -> loggerPollingSpeed = parser.getInteger(group + property, true);
|
||||
|
||||
case "hideFullTypePath" -> hideFullTypePath = parser.getBoolean(group + property);
|
||||
}
|
||||
} catch (NullPointerException ignored) {}
|
||||
}
|
||||
|
@ -361,6 +383,8 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
|||
loggerImmediateShutdown = false;
|
||||
loggerForceStandardOutput = false;
|
||||
loggerPollingSpeed = 5;
|
||||
|
||||
hideFullTypePath = false;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
@ -382,6 +406,8 @@ public final class EngineConfiguration implements SubsystemConfiguration {
|
|||
case "loggerImmediateShutdown" -> { return loggerImmediateShutdown; }
|
||||
case "loggerForceStandardOutput" -> { return loggerForceStandardOutput; }
|
||||
case "loggerPollingSpeed" -> { return loggerPollingSpeed; }
|
||||
|
||||
case "hideFullTypePath" -> { return hideFullTypePath; }
|
||||
default -> { return null; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package de.staropensource.sosengine.base.types.vectors;
|
||||
|
||||
import de.staropensource.sosengine.base.EngineConfiguration;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.SneakyThrows;
|
||||
|
@ -104,6 +105,9 @@ public class Vec2 {
|
|||
@NotNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + "(x=" + x + " y=" + y + ")";
|
||||
return (EngineConfiguration.getInstance().isHideFullTypePath()
|
||||
? getClass().getName().replace(getClass().getPackage() + ".", "")
|
||||
: getClass().getName())
|
||||
+ "(x=" + x + " y=" + y + ")";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package de.staropensource.sosengine.base.types.vectors;
|
||||
|
||||
import de.staropensource.sosengine.base.EngineConfiguration;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.SneakyThrows;
|
||||
|
@ -104,6 +105,9 @@ public class Vec2i implements Cloneable {
|
|||
@NotNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + "(x=" + x + " y=" + y + ")";
|
||||
return (EngineConfiguration.getInstance().isHideFullTypePath()
|
||||
? getClass().getName().replace(getClass().getPackage() + ".", "")
|
||||
: getClass().getName())
|
||||
+ "(x=" + x + " y=" + y + ")";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package de.staropensource.sosengine.base.types.vectors;
|
||||
|
||||
import de.staropensource.sosengine.base.EngineConfiguration;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.SneakyThrows;
|
||||
|
@ -125,6 +126,9 @@ public class Vec3 {
|
|||
@NotNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + "(x=" + x + " y=" + y + " z=" + z + ")";
|
||||
return (EngineConfiguration.getInstance().isHideFullTypePath()
|
||||
? getClass().getName().replace(getClass().getPackage() + ".", "")
|
||||
: getClass().getName())
|
||||
+ "(x=" + x + " y=" + y + ")";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package de.staropensource.sosengine.base.types.vectors;
|
||||
|
||||
import de.staropensource.sosengine.base.EngineConfiguration;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.SneakyThrows;
|
||||
|
@ -125,6 +126,9 @@ public class Vec3i {
|
|||
@NotNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + "(x=" + x + " y=" + y + " z=" + z + ")";
|
||||
return (EngineConfiguration.getInstance().isHideFullTypePath()
|
||||
? getClass().getName().replace(getClass().getPackage() + ".", "")
|
||||
: getClass().getName())
|
||||
+ "(x=" + x + " y=" + y + ")";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue