Package org.forgerock.util
Class Utils
java.lang.Object
org.forgerock.util.Utils
Deprecated.
Common utility methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Enum<T>>
TDeprecated.static void
closeSilently
(Closeable... resources) Deprecated.static void
closeSilently
(Iterable<? extends Closeable> resources) Deprecated.static int
compareValues
(Object v1, Object v2) Deprecated.static boolean
isBlank
(CharSequence charSeq) Deprecated.static boolean
isCompatible
(Object v1, Object v2) Deprecated.static boolean
isNullOrEmpty
(String value) Deprecated.static void
joinAsString
(StringBuilder builder, String separator, Iterable<?> values) Deprecated.static void
joinAsString
(StringBuilder builder, String separator, Object... values) Deprecated.static String
joinAsString
(String separator, Iterable<?> values) Deprecated.static String
joinAsString
(String separator, Object... values) Deprecated.static ThreadFactory
newThreadFactory
(ThreadGroup group, String nameTemplate, boolean isDaemon) Deprecated.
-
Method Details
-
closeSilently
Deprecated.Closes the provided resources ignoring any errors which occurred.- Parameters:
resources
- The resources to be closed, which may benull
.
-
closeSilently
Deprecated.Closes the provided resources ignoring any errors which occurred.- Parameters:
resources
- The resources to be closed, which may benull
.
-
joinAsString
Deprecated.Returns a string whose content is the string representation of the provided objects concatenated together using the provided separator.- Parameters:
separator
- The separator string.values
- The objects to be joined.- Returns:
- A string whose content is the string representation of the provided objects concatenated together using the provided separator.
- Throws:
NullPointerException
- Ifvalues
orseparator
werenull
.
-
joinAsString
Deprecated.Returns a string whose content is the string representation of the objects contained in the provided iterable concatenated together using the provided separator.- Parameters:
separator
- The separator string.values
- The iterable whose elements are to be joined.- Returns:
- A string whose content is the string representation of the objects contained in the provided iterable concatenated together using the provided separator.
- Throws:
NullPointerException
- Ifseparator
orvalues
werenull
.
-
joinAsString
@Deprecated public static void joinAsString(StringBuilder builder, String separator, Object... values) Deprecated.Appends into the providedStringBuilder
the string representation of the provided objects concatenated together using the provided separator.- Parameters:
builder
- The String builder where to append.separator
- The separator string.values
- The objects to be joined.- Throws:
NullPointerException
- Ifbuilder
,separator
orvalues
werenull
.
-
joinAsString
@Deprecated public static void joinAsString(StringBuilder builder, String separator, Iterable<?> values) Deprecated.Appends into the providedStringBuilder
the string representation of the objects contained in the provided iterable concatenated together using the provided separator.- Parameters:
builder
- The String builder where to append.separator
- The separator string.values
- The iterable whose elements are to be joined.- Throws:
NullPointerException
- Ifbuilder
,separator
orvalues
werenull
.
-
newThreadFactory
@Deprecated public static ThreadFactory newThreadFactory(ThreadGroup group, String nameTemplate, boolean isDaemon) Deprecated.Creates a new thread factory which will create threads using the specified thread group, naming template, and daemon status.- Parameters:
group
- The thread group, which may benull
.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.- Returns:
- The new thread factory.
-
asEnum
Deprecated.Returns the string value as an enum constant of the specified enum type. The string value and enum constants are compared, ignoring case considerations. If the string value isnull
, this method returnsnull
.- Type Parameters:
T
- the enum type sub-class.- Parameters:
value
- the string valuetype
- the enum type to match constants with the value.- Returns:
- the enum constant represented by the string value.
- Throws:
IllegalArgumentException
- iftype
does not represent an enum type, of ifvalue
does not match one of the enum constantsNullPointerException
- iftype
isnull
.
-
isNullOrEmpty
Deprecated.Check to see if the provided String isnull
or empty.- Parameters:
value
- The value to check.- Returns:
true
if the value is eithernull
or is empty.
-
isBlank
Deprecated.Check to see if a character sequence is null or blank.- Parameters:
charSeq
- Sequence to test (String is also a CharSequence)- Returns:
- true if the char sequence is null or blank.
-
compareValues
Deprecated.Compare two values based on types.- Parameters:
v1
- the first objectv2
- the second object- Returns:
- the value 0 if this first object is equal to the second argument; a value less than 0 if this object is numerically or lexicographically less than the second argument; and a value greater than 0 if this object is numerically or lexicographically greater than the second argument
-
isCompatible
Deprecated.Returns whether the two objects are type-compatible.- Parameters:
v1
- the first objectv2
- the second object- Returns:
- true if the objects are type-compatible
-
Strings
,Closeables
,Objects
orThreads
instead.