public final class Utils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T extends Enum<T>> |
asEnum(String value,
Class<T> type)
Returns the string value as an enum constant of the specified enum
type.
|
static void |
closeSilently(Closeable... resources)
Closes the provided resources ignoring any errors which occurred.
|
static void |
closeSilently(Iterable<? extends Closeable> resources)
Closes the provided resources ignoring any errors which occurred.
|
static boolean |
isNullOrEmpty(String value)
Check to see if the provided String is
null or empty. |
static void |
joinAsString(StringBuilder builder,
String separator,
Iterable<?> values)
Appends into the provided
StringBuilder the string representation
of the objects contained in the provided iterable concatenated together
using the provided separator. |
static void |
joinAsString(StringBuilder builder,
String separator,
Object... values)
Appends into the provided
StringBuilder the string representation
of the provided objects concatenated together using the provided separator. |
static String |
joinAsString(String separator,
Iterable<?> values)
Returns a string whose content is the string representation of the
objects contained in the provided iterable concatenated together using
the provided separator.
|
static String |
joinAsString(String separator,
Object... values)
Returns a string whose content is the string representation of the
provided objects concatenated together using the provided separator.
|
static ThreadFactory |
newThreadFactory(ThreadGroup group,
String nameTemplate,
boolean isDaemon)
Creates a new thread factory which will create threads using the
specified thread group, naming template, and daemon status.
|
public static void closeSilently(Closeable... resources)
resources - The resources to be closed, which may be null.public static void closeSilently(Iterable<? extends Closeable> resources)
resources - The resources to be closed, which may be null.public static String joinAsString(String separator, Object... values)
separator - The separator string.values - The objects to be joined.NullPointerException - If values or separator were null.public static String joinAsString(String separator, Iterable<?> values)
separator - The separator string.values - The iterable whose elements are to be joined.NullPointerException - If separator or values were null.public static void joinAsString(StringBuilder builder, String separator, Object... values)
StringBuilder the string representation
of the provided objects concatenated together using the provided separator.builder - The String builder where to append.separator - The separator string.values - The objects to be joined.NullPointerException - If builder, separator or values were null.public static void joinAsString(StringBuilder builder, String separator, Iterable<?> values)
StringBuilder the string representation
of the objects contained in the provided iterable concatenated together
using the provided separator.builder - The String builder where to append.separator - The separator string.values - The iterable whose elements are to be joined.NullPointerException - If builder, separator or values were null.public static ThreadFactory newThreadFactory(ThreadGroup group, String nameTemplate, boolean isDaemon)
group - The thread group, which may be null.nameTemplate - The thread name format string which may contain a "%d" format
option which will be substituted with the thread count.isDaemon - Indicates whether or not threads should be daemon threads.public static <T extends Enum<T>> T asEnum(String value, Class<T> type)
null, this method returns
null.T - the enum type sub-class.value - the string valuetype - the enum type to match constants with the value.IllegalArgumentException - if type does not represent an enum type,
of if value does not match one of the enum constantsNullPointerException - if type is null.public static boolean isNullOrEmpty(String value)
null or empty.value - The value to check.true if the value is either null or is empty.Copyright © 2025 Open Identity Platform Community. All rights reserved.