1
mirror of https://github.com/CarmJos/EasyConfiguration.git synced 2026-06-04 10:38:19 +08:00

chore(text): Add missing text functions

This commit is contained in:
2025-03-21 03:30:47 +08:00
parent c32a941906
commit 70a3b893a6
15 changed files with 29 additions and 14 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>cc.carm.lib</groupId>
<artifactId>configured-parent</artifactId>
<version>4.1.2</version>
<version>4.1.3</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<properties>
@@ -156,6 +156,11 @@ public abstract class ContentHandler<RECEIVER, SELF extends ContentHandler<RECEI
return self();
}
public SELF paramReplacer(@NotNull ParamReplacer<RECEIVER> paramReplacer) {
this.paramReplacer = paramReplacer;
return self();
}
@Override
public List<ContentInserter<RECEIVER>> inserters() {
return this.inserters;
@@ -246,6 +251,16 @@ public abstract class ContentHandler<RECEIVER, SELF extends ContentHandler<RECEI
}
}
public static String setPlaceholders(@NotNull String messages,
@NotNull Map<String, Object> placeholders) {
if (messages.isEmpty()) return messages;
String parsed = messages;
for (Map.Entry<String, Object> entry : placeholders.entrySet()) {
parsed = parsed.replace(entry.getKey(), entry.getValue() == null ? "" : entry.getValue().toString());
}
return parsed;
}
public static Map<String, Object> buildParams(@NotNull UnaryOperator<String> paramBuilder,
@Nullable String[] params, @Nullable Object[] values) {
Map<String, Object> map = new HashMap<>();