diff --git a/base/src/main/java/de/staropensource/sosengine/base/classes/Placeholder.java b/base/src/main/java/de/staropensource/sosengine/base/classes/Placeholder.java index 9314f060..792ab417 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/classes/Placeholder.java +++ b/base/src/main/java/de/staropensource/sosengine/base/classes/Placeholder.java @@ -30,15 +30,6 @@ import org.jetbrains.annotations.NotNull; */ @SuppressWarnings({ "unused" }) public interface Placeholder { - /** - * Returns the placeholder's name. - * - * @return the placeholder name - * @since v1-alpha0 - */ - @NotNull - String getName(); - /** * Replaces the placeholder with it's appropriate content. * diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/DateDay.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/DateDay.java index fffa4c9f..27fd5d43 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/DateDay.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/DateDay.java @@ -40,16 +40,10 @@ public final class DateDay implements Placeholder { */ public DateDay() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "date_day"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", Miscellaneous.padNumbers(Calendar.getInstance().get(Calendar.DAY_OF_MONTH), 2)); + return text.replace("%date_day%", Miscellaneous.padNumbers(Calendar.getInstance().get(Calendar.DAY_OF_MONTH), 2)); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/DateMonth.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/DateMonth.java index 4f9216b3..c608e567 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/DateMonth.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/DateMonth.java @@ -40,16 +40,10 @@ public final class DateMonth implements Placeholder { */ public DateMonth() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "date_month"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", Miscellaneous.padNumbers(Calendar.getInstance().get(Calendar.MONTH), 2)); + return text.replace("%date_month%", Miscellaneous.padNumbers(Calendar.getInstance().get(Calendar.MONTH), 2)); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/DateYear.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/DateYear.java index ae7132ce..7f24b2a7 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/DateYear.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/DateYear.java @@ -40,16 +40,10 @@ public final class DateYear implements Placeholder { */ public DateYear() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "date_year"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", Miscellaneous.padNumbers(Calendar.getInstance().get(Calendar.YEAR), 4)); + return text.replace("%date_year%", Miscellaneous.padNumbers(Calendar.getInstance().get(Calendar.YEAR), 4)); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyJansi.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyJansi.java index 587c8191..c55853a7 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyJansi.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyJansi.java @@ -38,16 +38,10 @@ public final class EngineDependencyJansi implements Placeholder { */ public EngineDependencyJansi() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_dependency_jansi"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getDependencyJansi()); + return text.replace("%engine_dependency_jansi%", EngineInformation.getDependencyJansi()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyJetbrainsAnnotations.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyJetbrainsAnnotations.java index 66479860..2b82556a 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyJetbrainsAnnotations.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyJetbrainsAnnotations.java @@ -38,16 +38,10 @@ public final class EngineDependencyJetbrainsAnnotations implements Placeholder { */ public EngineDependencyJetbrainsAnnotations() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_dependency_jetbrains_annotations"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getDependencyJetbrainsAnnotations()); + return text.replace("%engine_dependency_jetbrains_annotations%", EngineInformation.getDependencyJetbrainsAnnotations()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyLombok.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyLombok.java index c0a21541..116a1d52 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyLombok.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyLombok.java @@ -38,16 +38,10 @@ public final class EngineDependencyLombok implements Placeholder { */ public EngineDependencyLombok() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_dependency_lombok"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getDependencyLombok()); + return text.replace("%engine_dependency_lombok%", EngineInformation.getDependencyLombok()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyLwjgl.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyLwjgl.java index 624fd14e..cbbd20c2 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyLwjgl.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyLwjgl.java @@ -38,16 +38,10 @@ public final class EngineDependencyLwjgl implements Placeholder { */ public EngineDependencyLwjgl() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_dependency_lwjgl"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getDependencyLwjgl()); + return text.replace("%engine_dependency_lwjgl%", EngineInformation.getDependencyLwjgl()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyReflections.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyReflections.java index 8ce98dba..479f552f 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyReflections.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencyReflections.java @@ -38,16 +38,10 @@ public final class EngineDependencyReflections implements Placeholder { */ public EngineDependencyReflections() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_dependency_reflections"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getDependencyReflections()); + return text.replace("%engine_dependency_reflections%", EngineInformation.getDependencyReflections()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencySlf4j.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencySlf4j.java index 537f9d86..a731c712 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencySlf4j.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineDependencySlf4j.java @@ -38,16 +38,10 @@ public final class EngineDependencySlf4j implements Placeholder { */ public EngineDependencySlf4j() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_dependency_slf4j"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getDependencySlf4j()); + return text.replace("%engine_dependency_slf4j%", EngineInformation.getDependencySlf4j()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitBranch.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitBranch.java index d947fc22..ac77db0c 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitBranch.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitBranch.java @@ -38,16 +38,10 @@ public final class EngineGitBranch implements Placeholder { */ public EngineGitBranch() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_branch"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getGitBranch()); + return text.replace("%engine_git_branch%", EngineInformation.getGitBranch()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitHeader.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitHeader.java index a1a02eb2..b9abe3c6 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitHeader.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitHeader.java @@ -38,16 +38,10 @@ public final class EngineGitCommitHeader implements Placeholder { */ public EngineGitCommitHeader() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_commit_header"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getGitCommitHeader()); + return text.replace("%engine_git_commit_header%", EngineInformation.getGitCommitHeader()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitIdLong.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitIdLong.java index 363288ef..f84c02a8 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitIdLong.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitIdLong.java @@ -38,16 +38,10 @@ public final class EngineGitCommitIdLong implements Placeholder { */ public EngineGitCommitIdLong() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_commit_id_long"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getGitCommitIdentifierLong()); + return text.replace("%engine_git_commit_id_long%", EngineInformation.getGitCommitIdentifierLong()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitIdShort.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitIdShort.java index c5b8a839..c0327f96 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitIdShort.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitIdShort.java @@ -38,16 +38,10 @@ public final class EngineGitCommitIdShort implements Placeholder { */ public EngineGitCommitIdShort() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_commit_id_short"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getGitCommitIdentifierShort()); + return text.replace("%engine_git_commit_id_short%", EngineInformation.getGitCommitIdentifierShort()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeDay.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeDay.java index 14ed0b48..f3f5eef0 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeDay.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeDay.java @@ -38,16 +38,10 @@ public final class EngineGitCommitTimeDay implements Placeholder { */ public EngineGitCommitTimeDay() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_commit_time_day"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getGitCommitTime().getDayOfMonth())); + return text.replace("%engine_git_commit_time_day%", String.valueOf(EngineInformation.getGitCommitTime().getDayOfMonth())); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeHour.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeHour.java index 8ae182cc..36eadeca 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeHour.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeHour.java @@ -38,16 +38,10 @@ public final class EngineGitCommitTimeHour implements Placeholder { */ public EngineGitCommitTimeHour() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_commit_time_hour"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getGitCommitTime().getHour())); + return text.replace("%engine_git_commit_time_hour%", String.valueOf(EngineInformation.getGitCommitTime().getHour())); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeMinute.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeMinute.java index 5f3cd762..04b78730 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeMinute.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeMinute.java @@ -38,16 +38,10 @@ public final class EngineGitCommitTimeMinute implements Placeholder { */ public EngineGitCommitTimeMinute() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_commit_time_minute"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getGitCommitTime().getMinute())); + return text.replace("%engine_git_commit_time_minute%", String.valueOf(EngineInformation.getGitCommitTime().getMinute())); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeMonth.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeMonth.java index 95bc2d7c..582f16b9 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeMonth.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeMonth.java @@ -38,16 +38,10 @@ public final class EngineGitCommitTimeMonth implements Placeholder { */ public EngineGitCommitTimeMonth() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_commit_time_month"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getGitCommitTime().getMonth())); + return text.replace("%engine_git_commit_time_month%", String.valueOf(EngineInformation.getGitCommitTime().getMonth())); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeSecond.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeSecond.java index bd539266..1a403275 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeSecond.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeSecond.java @@ -38,16 +38,10 @@ public final class EngineGitCommitTimeSecond implements Placeholder { */ public EngineGitCommitTimeSecond() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_commit_time_second"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getGitCommitTime().getSecond())); + return text.replace("%engine_git_commit_time_second%", String.valueOf(EngineInformation.getGitCommitTime().getSecond())); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeYear.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeYear.java index 4a9e1071..471b7b16 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeYear.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitTimeYear.java @@ -38,16 +38,10 @@ public final class EngineGitCommitTimeYear implements Placeholder { */ public EngineGitCommitTimeYear() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_commit_time_year"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getGitCommitTime().getYear())); + return text.replace("%engine_git_commit_time_year%", String.valueOf(EngineInformation.getGitCommitTime().getYear())); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommits.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommits.java index 2f9d1175..26a8bfdb 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommits.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommits.java @@ -38,16 +38,10 @@ public final class EngineGitCommits implements Placeholder { */ public EngineGitCommits() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_commits"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getGitCommitCount())); + return text.replace("%engine_git_commits%", String.valueOf(EngineInformation.getGitCommitCount())); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitterEmail.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitterEmail.java index 0edf9565..b85b90a6 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitterEmail.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitterEmail.java @@ -38,16 +38,10 @@ public final class EngineGitCommitterEmail implements Placeholder { */ public EngineGitCommitterEmail() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_committer_email"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getGitCommitterEmail()); + return text.replace("%engine_git_committer_email%", EngineInformation.getGitCommitterEmail()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitterName.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitterName.java index 6a2c5a06..26b812e2 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitterName.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitCommitterName.java @@ -38,16 +38,10 @@ public final class EngineGitCommitterName implements Placeholder { */ public EngineGitCommitterName() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_committer_name"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getGitCommitterName()); + return text.replace("%engine_git_committer_name%", EngineInformation.getGitCommitterName()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitDirty.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitDirty.java index 15ae7bee..c5667a56 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitDirty.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineGitDirty.java @@ -38,16 +38,10 @@ public final class EngineGitDirty implements Placeholder { */ public EngineGitDirty() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_git_dirty"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getGitDirty())); + return text.replace("%engine_git_dirty%", String.valueOf(EngineInformation.getGitDirty())); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersion.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersion.java index ff56b300..2932b4fb 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersion.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersion.java @@ -37,16 +37,10 @@ public final class EngineVersion implements Placeholder { */ public EngineVersion() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_version"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", "v%engine_version_version%-%engine_version_type%%engine_version_typerelease%%engine_version_fork%"); + return text.replace("%engine_version%", "v%engine_version_version%-%engine_version_type%%engine_version_typerelease%%engine_version_fork%"); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionFork.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionFork.java index cbb12b4b..57f87933 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionFork.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionFork.java @@ -38,16 +38,10 @@ public final class EngineVersionFork implements Placeholder { */ public EngineVersionFork() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_version_fork"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getVersioningFork()); + return text.replace("%engine_version_fork%", EngineInformation.getVersioningFork()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionType.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionType.java index d5b4f974..6fb8c585 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionType.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionType.java @@ -38,16 +38,10 @@ public final class EngineVersionType implements Placeholder { */ public EngineVersionType() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_version_type"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", EngineInformation.getVersioningType().name().toLowerCase()); + return text.replace("%engine_version_type%", EngineInformation.getVersioningType().name().toLowerCase()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionTyperelease.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionTyperelease.java index 83e01279..d2fbcf34 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionTyperelease.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionTyperelease.java @@ -38,16 +38,10 @@ public final class EngineVersionTyperelease implements Placeholder { */ public EngineVersionTyperelease() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_version_typerelease"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getVersioningTyperelease())); + return text.replace("%engine_version_typerelease%", String.valueOf(EngineInformation.getVersioningTyperelease())); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionVersion.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionVersion.java index 38065a69..24a1e7e3 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionVersion.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/EngineVersionVersion.java @@ -38,16 +38,10 @@ public final class EngineVersionVersion implements Placeholder { */ public EngineVersionVersion() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "engine_version_version"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getVersioningVersion())); + return text.replace("%engine_version_version%", String.valueOf(EngineInformation.getVersioningVersion())); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmArguments.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmArguments.java index ddcd2380..9acce723 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmArguments.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmArguments.java @@ -38,13 +38,6 @@ public final class JvmArguments implements Placeholder { */ public JvmArguments() {} - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "jvm_arguments"; - } - /** {@inheritDoc} */ @NotNull @Override @@ -65,6 +58,6 @@ public final class JvmArguments implements Placeholder { .append("\""); } - return text.replace("%" + getName() + "%", arguments.toString()); + return text.replace("%jvm_arguments%", arguments.toString()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmImplementationName.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmImplementationName.java index cbe74589..bfa2c0f2 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmImplementationName.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmImplementationName.java @@ -38,17 +38,10 @@ public final class JvmImplementationName implements Placeholder { */ public JvmImplementationName() {} - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "jvm_implementation_name"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", JvmInformation.getImplementationName()); + return text.replace("%jvm_implementation_name%", JvmInformation.getImplementationName()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmImplementationVendor.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmImplementationVendor.java index 1cb64cd8..adea761e 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmImplementationVendor.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmImplementationVendor.java @@ -38,17 +38,10 @@ public final class JvmImplementationVendor implements Placeholder { */ public JvmImplementationVendor() {} - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "jvm_implementation_vendor"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", JvmInformation.getImplementationVendor()); + return text.replace("%jvm_implementation_vendor%", JvmInformation.getImplementationVendor()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmImplementationVersion.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmImplementationVersion.java index 97e42b60..6ed35b88 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmImplementationVersion.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmImplementationVersion.java @@ -38,17 +38,10 @@ public final class JvmImplementationVersion implements Placeholder { */ public JvmImplementationVersion() {} - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "jvm_implementation_version"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", JvmInformation.getImplementationVersion()); + return text.replace("%jvm_implementation_version%", JvmInformation.getImplementationVersion()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmJava.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmJava.java index 6388eecd..eb62eb16 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmJava.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmJava.java @@ -38,17 +38,10 @@ public final class JvmJava implements Placeholder { */ public JvmJava() {} - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "jvm_java"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", String.valueOf(JvmInformation.getJavaVersion())); + return text.replace("%jvm_java%", String.valueOf(JvmInformation.getJavaVersion())); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmUptime.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmUptime.java index 27d4ce64..22429001 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmUptime.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/JvmUptime.java @@ -38,17 +38,10 @@ public final class JvmUptime implements Placeholder { */ public JvmUptime() {} - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "jvm_uptime"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", String.valueOf(JvmInformation.getUptime())); + return text.replace("%jvm_uptime%", String.valueOf(JvmInformation.getUptime())); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeEpoch.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeEpoch.java index c9ced3c0..13022828 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeEpoch.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeEpoch.java @@ -39,16 +39,10 @@ public final class TimeEpoch implements Placeholder { */ public TimeEpoch() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "time_epoch"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", Miscellaneous.padNumbers(System.currentTimeMillis(), String.valueOf(Long.MAX_VALUE).length())); + return text.replace("%time_epoch%", Miscellaneous.padNumbers(System.currentTimeMillis(), String.valueOf(Long.MAX_VALUE).length())); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeHour.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeHour.java index 5235b99d..b988803c 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeHour.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeHour.java @@ -40,16 +40,10 @@ public final class TimeHour implements Placeholder { */ public TimeHour() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "time_hour"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", Miscellaneous.padNumbers(Calendar.getInstance().get(Calendar.HOUR_OF_DAY), 2)); + return text.replace("%time_hour%", Miscellaneous.padNumbers(Calendar.getInstance().get(Calendar.HOUR_OF_DAY), 2)); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeMinute.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeMinute.java index 6c8bcb40..3ba1f133 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeMinute.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeMinute.java @@ -40,16 +40,10 @@ public final class TimeMinute implements Placeholder { */ public TimeMinute() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "time_minute"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", Miscellaneous.padNumbers(Calendar.getInstance().get(Calendar.MINUTE), 2)); + return text.replace("%time_minute%", Miscellaneous.padNumbers(Calendar.getInstance().get(Calendar.MINUTE), 2)); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeSecond.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeSecond.java index 16e59610..9fb5e376 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeSecond.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeSecond.java @@ -40,16 +40,10 @@ public final class TimeSecond implements Placeholder { */ public TimeSecond() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "time_second"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", Miscellaneous.padNumbers(Calendar.getInstance().get(Calendar.SECOND), 2)); + return text.replace("%time_second%", Miscellaneous.padNumbers(Calendar.getInstance().get(Calendar.SECOND), 2)); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeZone.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeZone.java index 2d3b6045..1c7bff1f 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeZone.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/TimeZone.java @@ -39,16 +39,10 @@ public final class TimeZone implements Placeholder { */ public TimeZone() {} - /** {@inheritDoc} */ - @NotNull - public String getName() { - return "time_zone"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", java.util.TimeZone.getDefault().getDisplayName(false, java.util.TimeZone.SHORT, Locale.US)); + return text.replace("%time_zone%", java.util.TimeZone.getDefault().getDisplayName(false, java.util.TimeZone.SHORT, Locale.US)); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerClass.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerClass.java index 87452a6a..a4549254 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerClass.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerClass.java @@ -49,17 +49,10 @@ public final class IssuerClass implements Placeholder { this.logIssuer = logIssuer; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "issuer_class"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", logIssuer.getClazz().getName().replace(logIssuer.getClazz().getPackageName() + ".", "")); + return text.replace("%issuer_class%", logIssuer.getClazz().getName().replace(logIssuer.getClazz().getPackageName() + ".", "")); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerCodePart.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerCodePart.java index 3a9c5f9a..dd673384 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerCodePart.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerCodePart.java @@ -49,17 +49,10 @@ public final class IssuerCodePart implements Placeholder { this.logIssuer = logIssuer; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "issuer_code_part"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", logIssuer.getCodePart().name()); + return text.replace("%issuer_code_part%", logIssuer.getCodePart().name()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerInfo.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerInfo.java index c97e8216..697c9e97 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerInfo.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerInfo.java @@ -49,20 +49,15 @@ public final class IssuerInfo implements Placeholder { this.logIssuer = logIssuer; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "issuer_info"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - if (logIssuer.getAdditionalInformation() == null) - return text.replace("%" + getName() + "%", ""); - else - return text.replace("%" + getName() + "%", logIssuer.getAdditionalInformation()); + String replacement = ""; + + if (logIssuer.getAdditionalInformation() != null) + replacement = logIssuer.getAdditionalInformation(); + + return text.replace("%issuer_info%", replacement); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerMessage.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerMessage.java index 60cf7976..b41c50b0 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerMessage.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerMessage.java @@ -48,17 +48,10 @@ public final class IssuerMessage implements Placeholder { this.message = message; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "issuer_message"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", message); + return text.replace("%issuer_message%", message); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerPackage.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerPackage.java index a9e86020..788af058 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerPackage.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerPackage.java @@ -49,17 +49,10 @@ public final class IssuerPackage implements Placeholder { this.logIssuer = logIssuer; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "issuer_package"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", logIssuer.getClazz().getPackageName()); + return text.replace("%issuer_package%", logIssuer.getClazz().getPackageName()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerPath.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerPath.java index d54dfb93..dc600f5c 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerPath.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/IssuerPath.java @@ -49,17 +49,10 @@ public final class IssuerPath implements Placeholder { this.logIssuer = logIssuer; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "issuer_path"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", logIssuer.getClazz().getName()); + return text.replace("%issuer_path%", logIssuer.getClazz().getName()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/Stacktrace.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/Stacktrace.java index ab2e993a..0a3a528b 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/Stacktrace.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/crashhandler/Stacktrace.java @@ -50,23 +50,17 @@ public final class Stacktrace implements Placeholder { this.throwable = throwable; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "stacktrace"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - if (throwable == null) - return text.replace("%" + getName() + "%", "No stacktrace is available."); - else { - StackTraceParser stackTraceParser = new StackTraceParser(throwable); + String replacement = "No stacktrace is available."; - return text.replace("%" + getName() + "%", stackTraceParser.getHeader() + "\n" + stackTraceParser.getStackTrace()); + if (throwable != null) { + StackTraceParser stackTraceParser = new StackTraceParser(throwable); + replacement = stackTraceParser.getHeader() + "\n" + stackTraceParser.getStackTrace(); } + + return text.replace("%stacktrace%", replacement); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogClass.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogClass.java index 6bfdd4b3..97096837 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogClass.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogClass.java @@ -49,17 +49,10 @@ public final class LogClass implements Placeholder { this.logIssuer = logIssuer; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "log_class"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", logIssuer.getClazz().getName().replace(logIssuer.getClazz().getPackageName() + ".", "")); + return text.replace("%log_class%", logIssuer.getClazz().getName().replace(logIssuer.getClazz().getPackageName() + ".", "")); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogCodePart.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogCodePart.java index a23745c1..71311145 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogCodePart.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogCodePart.java @@ -49,17 +49,10 @@ public final class LogCodePart implements Placeholder { this.logIssuer = logIssuer; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "log_code_part"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", logIssuer.getCodePart().name()); + return text.replace("%log_code_part%", logIssuer.getCodePart().name()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogColorPrimary.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogColorPrimary.java index 080c0ed6..7e3b5252 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogColorPrimary.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogColorPrimary.java @@ -49,13 +49,6 @@ public final class LogColorPrimary implements Placeholder { this.level = level; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "log_color_primary"; - } - /** {@inheritDoc} */ @NotNull @Override @@ -71,6 +64,6 @@ public final class LogColorPrimary implements Placeholder { default -> color = ""; } - return text.replace("%" + getName() + "%", color); + return text.replace("%log_color_primary%", color); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogColorSecondary.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogColorSecondary.java index 4048af89..47fe45ab 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogColorSecondary.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogColorSecondary.java @@ -49,13 +49,6 @@ public final class LogColorSecondary implements Placeholder { this.level = level; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "log_color_secondary"; - } - /** {@inheritDoc} */ @NotNull @Override @@ -67,6 +60,6 @@ public final class LogColorSecondary implements Placeholder { default -> color = ""; } - return text.replace("%" + getName() + "%", color); + return text.replace("%log_color_secondary%", color); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogInfo.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogInfo.java index ba39afcb..6ac41a83 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogInfo.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogInfo.java @@ -49,19 +49,15 @@ public final class LogInfo implements Placeholder { this.logIssuer = logIssuer; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "log_info"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { + String replacement = ""; + if (logIssuer.getAdditionalInformation() != null) - return text.replace("%" + getName() + "%", "/" + logIssuer.getAdditionalInformation()); - return text.replace("%" + getName() + "%", ""); + replacement = "/" + logIssuer.getAdditionalInformation(); + + return text.replace("%log_info%", replacement); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogLevel.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogLevel.java index 19ec4516..37e4cc0e 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogLevel.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogLevel.java @@ -48,13 +48,6 @@ public final class LogLevel implements Placeholder { this.level = level; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "log_level"; - } - /** {@inheritDoc} */ @NotNull @Override @@ -68,6 +61,6 @@ public final class LogLevel implements Placeholder { default -> levelText = level.name().substring(0, 4); } - return text.replace("%" + getName() + "%", levelText); + return text.replace("%log_level%", levelText); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogMessage.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogMessage.java index 653c0f39..9996b2a0 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogMessage.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogMessage.java @@ -48,17 +48,10 @@ public final class LogMessage implements Placeholder { this.message = message; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "log_message"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", message); + return text.replace("%log_message%", message); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogPackage.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogPackage.java index 6ec148ac..42747de0 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogPackage.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogPackage.java @@ -49,17 +49,10 @@ public final class LogPackage implements Placeholder { this.logIssuer = logIssuer; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "log_package"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", logIssuer.getClazz().getPackageName()); + return text.replace("%log_package%", logIssuer.getClazz().getPackageName()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogPath.java b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogPath.java index 85bb986a..7b4e4622 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogPath.java +++ b/base/src/main/java/de/staropensource/sosengine/base/internal/placeholders/logger/LogPath.java @@ -49,17 +49,10 @@ public final class LogPath implements Placeholder { this.logIssuer = logIssuer; } - /** {@inheritDoc} */ - @NotNull - @Override - public String getName() { - return "log_path"; - } - /** {@inheritDoc} */ @NotNull @Override public String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", logIssuer.getClazz().getName()); + return text.replace("%log_path%", logIssuer.getClazz().getName()); } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/utility/PlaceholderEngine.java b/base/src/main/java/de/staropensource/sosengine/base/utility/PlaceholderEngine.java index bebe431a..ddf7306d 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/utility/PlaceholderEngine.java +++ b/base/src/main/java/de/staropensource/sosengine/base/utility/PlaceholderEngine.java @@ -144,13 +144,11 @@ public final class PlaceholderEngine { public String process(@NotNull String text, List<@NotNull Placeholder> temporaryPlaceholders) { // Process temporary placeholders for (Placeholder temporaryPlaceholder : temporaryPlaceholders) - if (text.contains("%" + temporaryPlaceholder.getName() + "%")) - text = temporaryPlaceholder.replace(text); + text = temporaryPlaceholder.replace(text); // Process normal placeholders for (Placeholder placeholder : placeholders) - if (text.contains("%" + placeholder.getName() + "%")) - text = placeholder.replace(text); + text = placeholder.replace(text); return text; } diff --git a/base/src/test/java/de/staropensource/sosengine/base/srctests/utility/PlaceholderEngineTest.java b/base/src/test/java/de/staropensource/sosengine/base/srctests/utility/PlaceholderEngineTest.java index 3091e985..9db77dcd 100644 --- a/base/src/test/java/de/staropensource/sosengine/base/srctests/utility/PlaceholderEngineTest.java +++ b/base/src/test/java/de/staropensource/sosengine/base/srctests/utility/PlaceholderEngineTest.java @@ -22,6 +22,7 @@ package de.staropensource.sosengine.base.srctests.utility; import de.staropensource.sosengine.base.classes.Placeholder; import de.staropensource.sosengine.base.exceptions.UnexpectedThrowableException; import de.staropensource.sosengine.base.exceptions.reflection.InvalidMethodException; +import de.staropensource.sosengine.base.exceptions.reflection.NoAccessException; import de.staropensource.sosengine.base.reflection.Reflect; import de.staropensource.sosengine.base.utility.PlaceholderEngine; import de.staropensource.sosengine.unittests.UnitLogger; @@ -61,7 +62,7 @@ class PlaceholderEngineTest { * Sets the {@link PlaceholderEngine}#{@code instance} to {@code null} after each test. */ @AfterEach - void clearInstance() throws InvalidMethodException, UnexpectedThrowableException, InvocationTargetException { + void clearInstance() throws InvalidMethodException, UnexpectedThrowableException, InvocationTargetException, NoAccessException { Reflect.reflectOn(PlaceholderEngine.class).getMethod("clearInstance").invoke(); } @@ -80,23 +81,15 @@ class PlaceholderEngineTest { List<@NotNull Placeholder> placeholders = new ArrayList<>(); placeholders.add(new Placeholder() { - @Override - public @NotNull String getName() { - return "test"; - } @Override public @NotNull String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", "TEST"); + return text.replace("%test%", "TEST"); } }); placeholders.add(new Placeholder() { - @Override - public @NotNull String getName() { - return "status"; - } @Override public @NotNull String replace(@NotNull String text) { - return text.replace("%" + getName() + "%", "works"); + return text.replace("%status%", "works"); } });