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 5883cae50 Test modernization, clean up utility classes.
5883cae50 is described below
commit 5883cae501f9682afa39c679f33d9386f0d2596a
Author: James Bognar <[email protected]>
AuthorDate: Mon Aug 25 16:33:41 2025 -0400
Test modernization, clean up utility classes.
---
.../main/java/org/apache/juneau/common/internal/Utils.java | 12 ------------
.../src/main/java/org/apache/juneau/swap/AutoListSwap.java | 5 +++--
.../src/main/java/org/apache/juneau/swap/AutoMapSwap.java | 5 +++--
.../src/main/java/org/apache/juneau/swap/AutoNumberSwap.java | 5 +++--
.../src/main/java/org/apache/juneau/swap/AutoObjectSwap.java | 5 +++--
5 files changed, 12 insertions(+), 20 deletions(-)
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/Utils.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/Utils.java
index 88ab25f26..78b7d8671 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/Utils.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/internal/Utils.java
@@ -1434,18 +1434,6 @@ public class Utils {
return value == null ? null :
Collections.unmodifiableSet(value);
}
- /**
- * Convenience method for creating an unmodifiable {@link
LinkedHashSet}.
- *
- * @param <E> The element type.
- * @param values The values to initialize the set with.
- * @return A new unmodifiable set.
- */
- @SafeVarargs
- public static <E> Set<E> uset2(E...values) {
- return u(set(values));
- }
-
/** Constructor */
protected Utils() {}
}
\ No newline at end of file
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoListSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoListSwap.java
index 004542c3e..90e980234 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoListSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoListSwap.java
@@ -12,6 +12,7 @@
//
***************************************************************************************************************************
package org.apache.juneau.swap;
+import static org.apache.juneau.common.internal.Utils.*;
import static org.apache.juneau.internal.ClassUtils.*;
import java.lang.reflect.*;
import java.util.*;
@@ -79,8 +80,8 @@ import org.apache.juneau.serializer.*;
public class AutoListSwap<T> extends ObjectSwap<T,List<?>> {
private static final Set<String>
- SWAP_METHOD_NAMES = Utils.uset2("toList", "toJsonList"),
- UNSWAP_METHOD_NAMES = Utils.uset2("fromList", "fromJsonList",
"create", "valueOf");
+ SWAP_METHOD_NAMES = u(set("toList", "toJsonList")),
+ UNSWAP_METHOD_NAMES = u(set("fromList", "fromJsonList",
"create", "valueOf"));
/**
* Look for constructors and methods on this class and construct a
dynamic swap if it's possible to do so.
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoMapSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoMapSwap.java
index 0a9528dbe..170a2de70 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoMapSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoMapSwap.java
@@ -12,6 +12,7 @@
//
***************************************************************************************************************************
package org.apache.juneau.swap;
+import static org.apache.juneau.common.internal.Utils.*;
import static org.apache.juneau.internal.ClassUtils.*;
import java.lang.reflect.*;
import java.util.*;
@@ -79,8 +80,8 @@ import org.apache.juneau.serializer.*;
public class AutoMapSwap<T> extends ObjectSwap<T,Map<?,?>> {
private static final Set<String>
- SWAP_METHOD_NAMES = Utils.uset2("toMap", "toJsonMap"),
- UNSWAP_METHOD_NAMES = Utils.uset2("fromMap", "fromJsonMap",
"create", "valueOf");
+ SWAP_METHOD_NAMES = u(set("toMap", "toJsonMap")),
+ UNSWAP_METHOD_NAMES = u(set("fromMap", "fromJsonMap", "create",
"valueOf"));
/**
* Look for constructors and methods on this class and construct a
dynamic swap if it's possible to do so.
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoNumberSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoNumberSwap.java
index e5b79fa53..055e9fff3 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoNumberSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoNumberSwap.java
@@ -12,6 +12,7 @@
//
***************************************************************************************************************************
package org.apache.juneau.swap;
+import static org.apache.juneau.common.internal.Utils.*;
import static org.apache.juneau.internal.ClassUtils.*;
import java.lang.reflect.*;
import java.util.*;
@@ -102,8 +103,8 @@ import org.apache.juneau.serializer.*;
public class AutoNumberSwap<T> extends ObjectSwap<T,Number> {
private static final Set<String>
- SWAP_METHOD_NAMES = Utils.uset2("toNumber", "toInteger",
"toInt", "toLong", "toFloat", "toDouble", "toShort", "toByte"),
- UNSWAP_METHOD_NAMES = Utils.uset2("fromInteger", "fromInt",
"fromLong", "fromFloat", "fromDouble", "fromShort", "fromByte", "create",
"valueOf");
+ SWAP_METHOD_NAMES = u(set("toNumber", "toInteger", "toInt",
"toLong", "toFloat", "toDouble", "toShort", "toByte")),
+ UNSWAP_METHOD_NAMES = u(set("fromInteger", "fromInt",
"fromLong", "fromFloat", "fromDouble", "fromShort", "fromByte", "create",
"valueOf"));
/**
* Look for constructors and methods on this class and construct a
dynamic swap if it's possible to do so.
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoObjectSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoObjectSwap.java
index ff88d740c..07ff49a4d 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoObjectSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoObjectSwap.java
@@ -12,6 +12,7 @@
//
***************************************************************************************************************************
package org.apache.juneau.swap;
+import static org.apache.juneau.common.internal.Utils.*;
import static org.apache.juneau.internal.ClassUtils.*;
import java.lang.reflect.*;
import java.util.*;
@@ -81,8 +82,8 @@ import org.apache.juneau.serializer.*;
public class AutoObjectSwap<T> extends ObjectSwap<T,Object> {
private static final Set<String>
- SWAP_METHOD_NAMES = Utils.uset2("swap", "toObject"),
- UNSWAP_METHOD_NAMES = Utils.uset2("unswap", "create",
"fromObject", "of");
+ SWAP_METHOD_NAMES = u(set("swap", "toObject")),
+ UNSWAP_METHOD_NAMES = u(set("unswap", "create", "fromObject",
"of"));
/**
* Inspects the specified class and returns a swap of this type if
possible.