From 70a3b893a62a91377bb18b275b6c8afa8d07430d Mon Sep 17 00:00:00 2001 From: carm Date: Fri, 21 Mar 2025 03:30:47 +0800 Subject: [PATCH] chore(text): Add missing text functions --- core/pom.xml | 2 +- demo/pom.xml | 2 +- features/commentable/pom.xml | 2 +- features/file/pom.xml | 2 +- features/section/pom.xml | 2 +- features/text/pom.xml | 2 +- .../value/text/function/ContentHandler.java | 15 +++++++++++++++ features/validators/pom.xml | 2 +- features/versioned/pom.xml | 2 +- pom.xml | 2 +- providers/gson/pom.xml | 2 +- providers/hocon/pom.xml | 2 +- providers/mongodb/pom.xml | 2 +- providers/sql/pom.xml | 2 +- providers/yaml/pom.xml | 2 +- 15 files changed, 29 insertions(+), 14 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index a497003..58bb71b 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -5,7 +5,7 @@ configured-parent cc.carm.lib - 4.1.2 + 4.1.3 4.0.0 diff --git a/demo/pom.xml b/demo/pom.xml index a217cb1..abbcf69 100644 --- a/demo/pom.xml +++ b/demo/pom.xml @@ -5,7 +5,7 @@ configured-parent cc.carm.lib - 4.1.2 + 4.1.3 4.0.0 diff --git a/features/commentable/pom.xml b/features/commentable/pom.xml index c61092b..b017c20 100644 --- a/features/commentable/pom.xml +++ b/features/commentable/pom.xml @@ -6,7 +6,7 @@ cc.carm.lib configured-parent - 4.1.2 + 4.1.3 ../../pom.xml diff --git a/features/file/pom.xml b/features/file/pom.xml index b621bf6..75d07d0 100644 --- a/features/file/pom.xml +++ b/features/file/pom.xml @@ -6,7 +6,7 @@ cc.carm.lib configured-parent - 4.1.2 + 4.1.3 ../../pom.xml diff --git a/features/section/pom.xml b/features/section/pom.xml index 1941aed..433cbfe 100644 --- a/features/section/pom.xml +++ b/features/section/pom.xml @@ -6,7 +6,7 @@ cc.carm.lib configured-parent - 4.1.2 + 4.1.3 ../../pom.xml diff --git a/features/text/pom.xml b/features/text/pom.xml index 2415324..fb1816e 100644 --- a/features/text/pom.xml +++ b/features/text/pom.xml @@ -6,7 +6,7 @@ cc.carm.lib configured-parent - 4.1.2 + 4.1.3 ../../pom.xml diff --git a/features/text/src/main/java/cc/carm/lib/configuration/value/text/function/ContentHandler.java b/features/text/src/main/java/cc/carm/lib/configuration/value/text/function/ContentHandler.java index 0c1b955..e1b5f88 100644 --- a/features/text/src/main/java/cc/carm/lib/configuration/value/text/function/ContentHandler.java +++ b/features/text/src/main/java/cc/carm/lib/configuration/value/text/function/ContentHandler.java @@ -156,6 +156,11 @@ public abstract class ContentHandler paramReplacer) { + this.paramReplacer = paramReplacer; + return self(); + } + @Override public List> inserters() { return this.inserters; @@ -246,6 +251,16 @@ public abstract class ContentHandler placeholders) { + if (messages.isEmpty()) return messages; + String parsed = messages; + for (Map.Entry entry : placeholders.entrySet()) { + parsed = parsed.replace(entry.getKey(), entry.getValue() == null ? "" : entry.getValue().toString()); + } + return parsed; + } + public static Map buildParams(@NotNull UnaryOperator paramBuilder, @Nullable String[] params, @Nullable Object[] values) { Map map = new HashMap<>(); diff --git a/features/validators/pom.xml b/features/validators/pom.xml index dedab50..7e7c640 100644 --- a/features/validators/pom.xml +++ b/features/validators/pom.xml @@ -6,7 +6,7 @@ cc.carm.lib configured-parent - 4.1.2 + 4.1.3 ../../pom.xml diff --git a/features/versioned/pom.xml b/features/versioned/pom.xml index 26c344c..24d4611 100644 --- a/features/versioned/pom.xml +++ b/features/versioned/pom.xml @@ -6,7 +6,7 @@ cc.carm.lib configured-parent - 4.1.2 + 4.1.3 ../../pom.xml diff --git a/pom.xml b/pom.xml index 7ae54fe..c75a608 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ cc.carm.lib configured-parent pom - 4.1.2 + 4.1.3 core features/section diff --git a/providers/gson/pom.xml b/providers/gson/pom.xml index ade036f..f7d5dcd 100644 --- a/providers/gson/pom.xml +++ b/providers/gson/pom.xml @@ -5,7 +5,7 @@ configured-parent cc.carm.lib - 4.1.2 + 4.1.3 ../../pom.xml 4.0.0 diff --git a/providers/hocon/pom.xml b/providers/hocon/pom.xml index c64d73e..ab6c3dc 100644 --- a/providers/hocon/pom.xml +++ b/providers/hocon/pom.xml @@ -6,7 +6,7 @@ cc.carm.lib configured-parent - 4.1.2 + 4.1.3 ../../pom.xml diff --git a/providers/mongodb/pom.xml b/providers/mongodb/pom.xml index 2f14f20..0365e19 100644 --- a/providers/mongodb/pom.xml +++ b/providers/mongodb/pom.xml @@ -5,7 +5,7 @@ configured-parent cc.carm.lib - 4.1.2 + 4.1.3 ../../pom.xml 4.0.0 diff --git a/providers/sql/pom.xml b/providers/sql/pom.xml index bd30fd4..721050e 100644 --- a/providers/sql/pom.xml +++ b/providers/sql/pom.xml @@ -6,7 +6,7 @@ configured-parent cc.carm.lib - 4.1.2 + 4.1.3 ../../pom.xml diff --git a/providers/yaml/pom.xml b/providers/yaml/pom.xml index af887c7..b724faf 100644 --- a/providers/yaml/pom.xml +++ b/providers/yaml/pom.xml @@ -6,7 +6,7 @@ configured-parent cc.carm.lib - 4.1.2 + 4.1.3 ../../pom.xml