forked from StarOpenSource/Engine
Allow for placeholder configuration
This commit is contained in:
parent
10abe1d3f0
commit
ccc6c31cc9
58 changed files with 75 additions and 439 deletions
|
@ -30,15 +30,6 @@ import org.jetbrains.annotations.NotNull;
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unused" })
|
@SuppressWarnings({ "unused" })
|
||||||
public interface Placeholder {
|
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.
|
* Replaces the placeholder with it's appropriate content.
|
||||||
*
|
*
|
||||||
|
|
|
@ -40,16 +40,10 @@ public final class DateDay implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public DateDay() {}
|
public DateDay() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "date_day";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,16 +40,10 @@ public final class DateMonth implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public DateMonth() {}
|
public DateMonth() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "date_month";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,16 +40,10 @@ public final class DateYear implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public DateYear() {}
|
public DateYear() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "date_year";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineDependencyJansi implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineDependencyJansi() {}
|
public EngineDependencyJansi() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_dependency_jansi";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getDependencyJansi());
|
return text.replace("%engine_dependency_jansi%", EngineInformation.getDependencyJansi());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineDependencyJetbrainsAnnotations implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineDependencyJetbrainsAnnotations() {}
|
public EngineDependencyJetbrainsAnnotations() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_dependency_jetbrains_annotations";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getDependencyJetbrainsAnnotations());
|
return text.replace("%engine_dependency_jetbrains_annotations%", EngineInformation.getDependencyJetbrainsAnnotations());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineDependencyLombok implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineDependencyLombok() {}
|
public EngineDependencyLombok() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_dependency_lombok";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getDependencyLombok());
|
return text.replace("%engine_dependency_lombok%", EngineInformation.getDependencyLombok());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineDependencyLwjgl implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineDependencyLwjgl() {}
|
public EngineDependencyLwjgl() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_dependency_lwjgl";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getDependencyLwjgl());
|
return text.replace("%engine_dependency_lwjgl%", EngineInformation.getDependencyLwjgl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineDependencyReflections implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineDependencyReflections() {}
|
public EngineDependencyReflections() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_dependency_reflections";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getDependencyReflections());
|
return text.replace("%engine_dependency_reflections%", EngineInformation.getDependencyReflections());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineDependencySlf4j implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineDependencySlf4j() {}
|
public EngineDependencySlf4j() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_dependency_slf4j";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getDependencySlf4j());
|
return text.replace("%engine_dependency_slf4j%", EngineInformation.getDependencySlf4j());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitBranch implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitBranch() {}
|
public EngineGitBranch() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_branch";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getGitBranch());
|
return text.replace("%engine_git_branch%", EngineInformation.getGitBranch());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitCommitHeader implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitCommitHeader() {}
|
public EngineGitCommitHeader() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_commit_header";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getGitCommitHeader());
|
return text.replace("%engine_git_commit_header%", EngineInformation.getGitCommitHeader());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitCommitIdLong implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitCommitIdLong() {}
|
public EngineGitCommitIdLong() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_commit_id_long";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getGitCommitIdentifierLong());
|
return text.replace("%engine_git_commit_id_long%", EngineInformation.getGitCommitIdentifierLong());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitCommitIdShort implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitCommitIdShort() {}
|
public EngineGitCommitIdShort() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_commit_id_short";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getGitCommitIdentifierShort());
|
return text.replace("%engine_git_commit_id_short%", EngineInformation.getGitCommitIdentifierShort());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitCommitTimeDay implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitCommitTimeDay() {}
|
public EngineGitCommitTimeDay() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_commit_time_day";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitCommitTimeHour implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitCommitTimeHour() {}
|
public EngineGitCommitTimeHour() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_commit_time_hour";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitCommitTimeMinute implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitCommitTimeMinute() {}
|
public EngineGitCommitTimeMinute() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_commit_time_minute";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitCommitTimeMonth implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitCommitTimeMonth() {}
|
public EngineGitCommitTimeMonth() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_commit_time_month";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitCommitTimeSecond implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitCommitTimeSecond() {}
|
public EngineGitCommitTimeSecond() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_commit_time_second";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitCommitTimeYear implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitCommitTimeYear() {}
|
public EngineGitCommitTimeYear() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_commit_time_year";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitCommits implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitCommits() {}
|
public EngineGitCommits() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_commits";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getGitCommitCount()));
|
return text.replace("%engine_git_commits%", String.valueOf(EngineInformation.getGitCommitCount()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitCommitterEmail implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitCommitterEmail() {}
|
public EngineGitCommitterEmail() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_committer_email";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getGitCommitterEmail());
|
return text.replace("%engine_git_committer_email%", EngineInformation.getGitCommitterEmail());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitCommitterName implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitCommitterName() {}
|
public EngineGitCommitterName() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_committer_name";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getGitCommitterName());
|
return text.replace("%engine_git_committer_name%", EngineInformation.getGitCommitterName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineGitDirty implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineGitDirty() {}
|
public EngineGitDirty() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_git_dirty";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getGitDirty()));
|
return text.replace("%engine_git_dirty%", String.valueOf(EngineInformation.getGitDirty()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,16 +37,10 @@ public final class EngineVersion implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineVersion() {}
|
public EngineVersion() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_version";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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%");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineVersionFork implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineVersionFork() {}
|
public EngineVersionFork() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_version_fork";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getVersioningFork());
|
return text.replace("%engine_version_fork%", EngineInformation.getVersioningFork());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineVersionType implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineVersionType() {}
|
public EngineVersionType() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_version_type";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", EngineInformation.getVersioningType().name().toLowerCase());
|
return text.replace("%engine_version_type%", EngineInformation.getVersioningType().name().toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineVersionTyperelease implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineVersionTyperelease() {}
|
public EngineVersionTyperelease() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_version_typerelease";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getVersioningTyperelease()));
|
return text.replace("%engine_version_typerelease%", String.valueOf(EngineInformation.getVersioningTyperelease()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,10 @@ public final class EngineVersionVersion implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public EngineVersionVersion() {}
|
public EngineVersionVersion() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "engine_version_version";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", String.valueOf(EngineInformation.getVersioningVersion()));
|
return text.replace("%engine_version_version%", String.valueOf(EngineInformation.getVersioningVersion()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,13 +38,6 @@ public final class JvmArguments implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public JvmArguments() {}
|
public JvmArguments() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "jvm_arguments";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
|
@ -65,6 +58,6 @@ public final class JvmArguments implements Placeholder {
|
||||||
.append("\"");
|
.append("\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
return text.replace("%" + getName() + "%", arguments.toString());
|
return text.replace("%jvm_arguments%", arguments.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,17 +38,10 @@ public final class JvmImplementationName implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public JvmImplementationName() {}
|
public JvmImplementationName() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "jvm_implementation_name";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", JvmInformation.getImplementationName());
|
return text.replace("%jvm_implementation_name%", JvmInformation.getImplementationName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,17 +38,10 @@ public final class JvmImplementationVendor implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public JvmImplementationVendor() {}
|
public JvmImplementationVendor() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "jvm_implementation_vendor";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", JvmInformation.getImplementationVendor());
|
return text.replace("%jvm_implementation_vendor%", JvmInformation.getImplementationVendor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,17 +38,10 @@ public final class JvmImplementationVersion implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public JvmImplementationVersion() {}
|
public JvmImplementationVersion() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "jvm_implementation_version";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", JvmInformation.getImplementationVersion());
|
return text.replace("%jvm_implementation_version%", JvmInformation.getImplementationVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,17 +38,10 @@ public final class JvmJava implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public JvmJava() {}
|
public JvmJava() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "jvm_java";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", String.valueOf(JvmInformation.getJavaVersion()));
|
return text.replace("%jvm_java%", String.valueOf(JvmInformation.getJavaVersion()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,17 +38,10 @@ public final class JvmUptime implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public JvmUptime() {}
|
public JvmUptime() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "jvm_uptime";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", String.valueOf(JvmInformation.getUptime()));
|
return text.replace("%jvm_uptime%", String.valueOf(JvmInformation.getUptime()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,16 +39,10 @@ public final class TimeEpoch implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public TimeEpoch() {}
|
public TimeEpoch() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "time_epoch";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,16 +40,10 @@ public final class TimeHour implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public TimeHour() {}
|
public TimeHour() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "time_hour";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,16 +40,10 @@ public final class TimeMinute implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public TimeMinute() {}
|
public TimeMinute() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "time_minute";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,16 +40,10 @@ public final class TimeSecond implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public TimeSecond() {}
|
public TimeSecond() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "time_second";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,16 +39,10 @@ public final class TimeZone implements Placeholder {
|
||||||
*/
|
*/
|
||||||
public TimeZone() {}
|
public TimeZone() {}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
public String getName() {
|
|
||||||
return "time_zone";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,17 +49,10 @@ public final class IssuerClass implements Placeholder {
|
||||||
this.logIssuer = logIssuer;
|
this.logIssuer = logIssuer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "issuer_class";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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() + ".", ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,17 +49,10 @@ public final class IssuerCodePart implements Placeholder {
|
||||||
this.logIssuer = logIssuer;
|
this.logIssuer = logIssuer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "issuer_code_part";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", logIssuer.getCodePart().name());
|
return text.replace("%issuer_code_part%", logIssuer.getCodePart().name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,20 +49,15 @@ public final class IssuerInfo implements Placeholder {
|
||||||
this.logIssuer = logIssuer;
|
this.logIssuer = logIssuer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "issuer_info";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
if (logIssuer.getAdditionalInformation() == null)
|
String replacement = "<none>";
|
||||||
return text.replace("%" + getName() + "%", "<none>");
|
|
||||||
else
|
if (logIssuer.getAdditionalInformation() != null)
|
||||||
return text.replace("%" + getName() + "%", logIssuer.getAdditionalInformation());
|
replacement = logIssuer.getAdditionalInformation();
|
||||||
|
|
||||||
|
return text.replace("%issuer_info%", replacement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,17 +48,10 @@ public final class IssuerMessage implements Placeholder {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "issuer_message";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", message);
|
return text.replace("%issuer_message%", message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,17 +49,10 @@ public final class IssuerPackage implements Placeholder {
|
||||||
this.logIssuer = logIssuer;
|
this.logIssuer = logIssuer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "issuer_package";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", logIssuer.getClazz().getPackageName());
|
return text.replace("%issuer_package%", logIssuer.getClazz().getPackageName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,17 +49,10 @@ public final class IssuerPath implements Placeholder {
|
||||||
this.logIssuer = logIssuer;
|
this.logIssuer = logIssuer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "issuer_path";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", logIssuer.getClazz().getName());
|
return text.replace("%issuer_path%", logIssuer.getClazz().getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,23 +50,17 @@ public final class Stacktrace implements Placeholder {
|
||||||
this.throwable = throwable;
|
this.throwable = throwable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "stacktrace";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
if (throwable == null)
|
String replacement = "No stacktrace is available.";
|
||||||
return text.replace("%" + getName() + "%", "No stacktrace is available.");
|
|
||||||
else {
|
|
||||||
StackTraceParser stackTraceParser = new StackTraceParser(throwable);
|
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,17 +49,10 @@ public final class LogClass implements Placeholder {
|
||||||
this.logIssuer = logIssuer;
|
this.logIssuer = logIssuer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "log_class";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
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() + ".", ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,17 +49,10 @@ public final class LogCodePart implements Placeholder {
|
||||||
this.logIssuer = logIssuer;
|
this.logIssuer = logIssuer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "log_code_part";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", logIssuer.getCodePart().name());
|
return text.replace("%log_code_part%", logIssuer.getCodePart().name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,13 +49,6 @@ public final class LogColorPrimary implements Placeholder {
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "log_color_primary";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,6 +64,6 @@ public final class LogColorPrimary implements Placeholder {
|
||||||
default -> color = "";
|
default -> color = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return text.replace("%" + getName() + "%", color);
|
return text.replace("%log_color_primary%", color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,13 +49,6 @@ public final class LogColorSecondary implements Placeholder {
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "log_color_secondary";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
|
@ -67,6 +60,6 @@ public final class LogColorSecondary implements Placeholder {
|
||||||
default -> color = "";
|
default -> color = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return text.replace("%" + getName() + "%", color);
|
return text.replace("%log_color_secondary%", color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,19 +49,15 @@ public final class LogInfo implements Placeholder {
|
||||||
this.logIssuer = logIssuer;
|
this.logIssuer = logIssuer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "log_info";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
|
String replacement = "";
|
||||||
|
|
||||||
if (logIssuer.getAdditionalInformation() != null)
|
if (logIssuer.getAdditionalInformation() != null)
|
||||||
return text.replace("%" + getName() + "%", "/" + logIssuer.getAdditionalInformation());
|
replacement = "/" + logIssuer.getAdditionalInformation();
|
||||||
return text.replace("%" + getName() + "%", "");
|
|
||||||
|
return text.replace("%log_info%", replacement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,13 +48,6 @@ public final class LogLevel implements Placeholder {
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "log_level";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,6 +61,6 @@ public final class LogLevel implements Placeholder {
|
||||||
default -> levelText = level.name().substring(0, 4);
|
default -> levelText = level.name().substring(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return text.replace("%" + getName() + "%", levelText);
|
return text.replace("%log_level%", levelText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,17 +48,10 @@ public final class LogMessage implements Placeholder {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "log_message";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", message);
|
return text.replace("%log_message%", message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,17 +49,10 @@ public final class LogPackage implements Placeholder {
|
||||||
this.logIssuer = logIssuer;
|
this.logIssuer = logIssuer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "log_package";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", logIssuer.getClazz().getPackageName());
|
return text.replace("%log_package%", logIssuer.getClazz().getPackageName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,17 +49,10 @@ public final class LogPath implements Placeholder {
|
||||||
this.logIssuer = logIssuer;
|
this.logIssuer = logIssuer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "log_path";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String replace(@NotNull String text) {
|
public String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", logIssuer.getClazz().getName());
|
return text.replace("%log_path%", logIssuer.getClazz().getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,12 +144,10 @@ public final class PlaceholderEngine {
|
||||||
public String process(@NotNull String text, List<@NotNull Placeholder> temporaryPlaceholders) {
|
public String process(@NotNull String text, List<@NotNull Placeholder> temporaryPlaceholders) {
|
||||||
// Process temporary placeholders
|
// Process temporary placeholders
|
||||||
for (Placeholder temporaryPlaceholder : temporaryPlaceholders)
|
for (Placeholder temporaryPlaceholder : temporaryPlaceholders)
|
||||||
if (text.contains("%" + temporaryPlaceholder.getName() + "%"))
|
|
||||||
text = temporaryPlaceholder.replace(text);
|
text = temporaryPlaceholder.replace(text);
|
||||||
|
|
||||||
// Process normal placeholders
|
// Process normal placeholders
|
||||||
for (Placeholder placeholder : placeholders)
|
for (Placeholder placeholder : placeholders)
|
||||||
if (text.contains("%" + placeholder.getName() + "%"))
|
|
||||||
text = placeholder.replace(text);
|
text = placeholder.replace(text);
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
|
|
|
@ -22,6 +22,7 @@ package de.staropensource.sosengine.base.srctests.utility;
|
||||||
import de.staropensource.sosengine.base.classes.Placeholder;
|
import de.staropensource.sosengine.base.classes.Placeholder;
|
||||||
import de.staropensource.sosengine.base.exceptions.UnexpectedThrowableException;
|
import de.staropensource.sosengine.base.exceptions.UnexpectedThrowableException;
|
||||||
import de.staropensource.sosengine.base.exceptions.reflection.InvalidMethodException;
|
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.reflection.Reflect;
|
||||||
import de.staropensource.sosengine.base.utility.PlaceholderEngine;
|
import de.staropensource.sosengine.base.utility.PlaceholderEngine;
|
||||||
import de.staropensource.sosengine.unittests.UnitLogger;
|
import de.staropensource.sosengine.unittests.UnitLogger;
|
||||||
|
@ -61,7 +62,7 @@ class PlaceholderEngineTest {
|
||||||
* Sets the {@link PlaceholderEngine}#{@code instance} to {@code null} after each test.
|
* Sets the {@link PlaceholderEngine}#{@code instance} to {@code null} after each test.
|
||||||
*/
|
*/
|
||||||
@AfterEach
|
@AfterEach
|
||||||
void clearInstance() throws InvalidMethodException, UnexpectedThrowableException, InvocationTargetException {
|
void clearInstance() throws InvalidMethodException, UnexpectedThrowableException, InvocationTargetException, NoAccessException {
|
||||||
Reflect.reflectOn(PlaceholderEngine.class).getMethod("clearInstance").invoke();
|
Reflect.reflectOn(PlaceholderEngine.class).getMethod("clearInstance").invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,23 +81,15 @@ class PlaceholderEngineTest {
|
||||||
|
|
||||||
List<@NotNull Placeholder> placeholders = new ArrayList<>();
|
List<@NotNull Placeholder> placeholders = new ArrayList<>();
|
||||||
placeholders.add(new Placeholder() {
|
placeholders.add(new Placeholder() {
|
||||||
@Override
|
|
||||||
public @NotNull String getName() {
|
|
||||||
return "test";
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", "TEST");
|
return text.replace("%test%", "TEST");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
placeholders.add(new Placeholder() {
|
placeholders.add(new Placeholder() {
|
||||||
@Override
|
|
||||||
public @NotNull String getName() {
|
|
||||||
return "status";
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull String replace(@NotNull String text) {
|
public @NotNull String replace(@NotNull String text) {
|
||||||
return text.replace("%" + getName() + "%", "works");
|
return text.replace("%status%", "works");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue