public final class Utils
extends java.lang.Object
构造器和说明 |
---|
Utils() |
限定符和类型 | 方法和说明 |
---|---|
static <T> java.util.List<T> |
asList(T... ary)
转为一个可变 List
|
static java.util.Map |
asMap(java.lang.Object... keyValues)
转为一个可变 Map
|
static <T> java.util.Set<T> |
asSet(T... ary)
转为一个可变 Set
|
static boolean |
hasText(java.lang.String str)
Check whether the given
String contains actual text. |
static boolean |
isBlank(java.lang.String str) |
static boolean |
isEmpty(java.util.Collection<?> collection)
Return
true if the supplied Collection is null or empty. |
static boolean |
isEmpty(java.util.Map<?,?> map)
Return
true if the supplied Map is null or empty. |
static java.net.URI |
resolveUri(java.net.URI baseUrl,
java.lang.String endpointUrl)
Resolves the given endpoint URL against the base URL.
|
public static boolean hasText(@Nullable java.lang.String str)
String
contains actual text.
More specifically, this method returns true
if the String
is not
null
, its length is greater than 0, and it contains at least one
non-whitespace character.
str
- the String
to check (may be null
)true
if the String
is not null
, its length is
greater than 0, and it does not contain whitespace onlyCharacter.isWhitespace(char)
public static boolean isBlank(java.lang.String str)
public static boolean isEmpty(@Nullable java.util.Collection<?> collection)
true
if the supplied Collection is null
or empty. Otherwise,
return false
.collection
- the Collection to checkpublic static boolean isEmpty(@Nullable java.util.Map<?,?> map)
true
if the supplied Map is null
or empty. Otherwise, return
false
.map
- the Map to checkpublic static java.net.URI resolveUri(java.net.URI baseUrl, java.lang.String endpointUrl)
IllegalArgumentException
is
thrown.baseUrl
- The base URL (must be absolute)endpointUrl
- The endpoint URL (can be relative or absolute)java.lang.IllegalArgumentException
- If the absolute endpoint URL does not match the
base URL or URI is malformedpublic static <T> java.util.List<T> asList(T... ary)
public static <T> java.util.Set<T> asSet(T... ary)
public static java.util.Map asMap(java.lang.Object... keyValues)