This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 113e2418f4 StringFormatter class
113e2418f4 is described below
commit 113e2418f4a107ab1749e01e178858895383f660
Author: James Bognar <[email protected]>
AuthorDate: Sun Nov 30 09:21:20 2025 -0500
StringFormatter class
---
TODO-StringUtils.md | 16 +++++++++-------
.../apache/juneau/assertions/FluentObjectAssertion.java | 2 +-
.../java/org/apache/juneau/common/utils/StringUtils.java | 16 ----------------
3 files changed, 10 insertions(+), 24 deletions(-)
diff --git a/TODO-StringUtils.md b/TODO-StringUtils.md
index 1811b03f8d..ecb50faa0c 100644
--- a/TODO-StringUtils.md
+++ b/TODO-StringUtils.md
@@ -227,10 +227,12 @@ The `StringUtils` class currently has 225+ public static
methods covering:
## Methods to Review/Deprecate
-- ⚠️ `stringifyDeep(Object o)` - Determine if this method is still required or
if it can be replaced with `readable()`. Currently used in:
- - `FluentObjectAssertion.equals()` for array comparison (line 566)
- - Previously used in `AssertionPredicate.VALUE` but has been replaced with
`readable()`
- - Review differences in behavior between `stringifyDeep()` and `readable()`:
- - `stringifyDeep()` uses `toString()` for Collections (adds spaces: `[a,
b, c]`)
- - `readable()` uses `Collectors.joining(",")` for Collections (no spaces:
`[a,b,c]`)
- - If `stringifyDeep()` can be replaced, update all usages and consider
deprecating/removing the method
+- ✅ `stringifyDeep(Object o)` - **COMPLETED**: Replaced with `readable()` and
deprecated.
+ - ✅ Replaced usage in `FluentObjectAssertion.equals()` (line 566) with
`readable()`
+ - ✅ Previously used in `AssertionPredicate.VALUE` but has been replaced with
`readable()`
+ - ✅ Method has been deprecated with `@Deprecated` annotation and Javadoc
updated to recommend using `readable()` instead
+ - ✅ Differences in behavior:
+ - `stringifyDeep()` uses `Arrays.toString()`/`Arrays.deepToString()` for
arrays (adds spaces: `[a, b, c]`)
+ - `readable()` uses `Collectors.joining(",")` for collections/arrays (no
spaces: `[a,b,c]`)
+ - `readable()` also handles byte arrays as hex (`0102`) vs
`stringifyDeep()` which uses `[1, 2]`
+ - ✅ All usages have been updated and the method is now deprecated
diff --git
a/juneau-core/juneau-assertions/src/main/java/org/apache/juneau/assertions/FluentObjectAssertion.java
b/juneau-core/juneau-assertions/src/main/java/org/apache/juneau/assertions/FluentObjectAssertion.java
index 086c915db9..e5a4373136 100644
---
a/juneau-core/juneau-assertions/src/main/java/org/apache/juneau/assertions/FluentObjectAssertion.java
+++
b/juneau-core/juneau-assertions/src/main/java/org/apache/juneau/assertions/FluentObjectAssertion.java
@@ -563,7 +563,7 @@ public class FluentObjectAssertion<T,R> extends
FluentAssertion<R> {
if (o1.equals(o2))
return true;
if (isArray(o1))
- return stringifyDeep(o1).equals(stringifyDeep(o2));
+ return readable(o1).equals(readable(o2));
return false;
}
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/StringUtils.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/StringUtils.java
index e0fa1eb8b2..cf3b879027 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/StringUtils.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/utils/StringUtils.java
@@ -4927,22 +4927,6 @@ public class StringUtils {
return false;
}
- /**
- * Converts the specified array to a string.
- *
- * @param o The array to convert to a string.
- * @return The array converted to a string, or <jk>null</jk> if the
object was null.
- */
- public static String stringifyDeep(Object o) {
- if (o == null)
- return null;
- if (! isArray(o))
- return o.toString();
- if (o.getClass().getComponentType().isPrimitive())
- return
PRIMITIVE_ARRAY_STRINGIFIERS.get(o.getClass()).apply(o);
- return Arrays.deepToString((Object[])o);
- }
-
/**
* Strips the first and last character from a string.
*