Initial commit

This commit is contained in:
Stijn
2022-03-09 22:11:11 +01:00
commit 9f1f62d593
34 changed files with 933 additions and 0 deletions
@@ -0,0 +1,10 @@
package com.alttd.templates;
public class Parser {
public static String parse(String message, Template... templates) {
for (Template template : templates) {
message = template.apply(message);
}
return message;
}
}
@@ -0,0 +1,20 @@
package com.alttd.templates;
public class Template {
private final String key;
private final String replacement;
private Template(String key, String replacement) {
this.key = key;
this.replacement = replacement;
}
public static Template of(String key, String replacement) {
return new Template("<" + key + ">", replacement);
}
protected String apply(String string) {
return string.replaceAll(key, replacement);
}
}