public class Utils extends Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
checkNotNull(T ref,
String message) |
static void |
closeQuietly(Closeable... closeables)
Closes and flushes the specified
Closeable items. |
static void |
closeQuietly(Iterable<Closeable> closeables)
Closes and flushes the specified
Closeable items. |
static String |
coalesce(String... items) |
static String |
convertSystemPropertyNameToEnvVar(String systemPropertyName) |
static String |
filePath(URL path) |
static String |
getEnvVar(String envVarName,
String defaultValue) |
static String |
getProperty(Map<String,Object> properties,
String propertyName) |
static String |
getProperty(Map<String,Object> properties,
String propertyName,
String defaultValue) |
static String |
getSystemPropertyOrEnvVar(String systemPropertyName) |
static Boolean |
getSystemPropertyOrEnvVar(String systemPropertyName,
Boolean defaultValue) |
static int |
getSystemPropertyOrEnvVar(String systemPropertyName,
int defaultValue) |
static String |
getSystemPropertyOrEnvVar(String systemPropertyName,
String defaultValue) |
static String |
getSystemPropertyOrEnvVar(String systemPropertyName,
String envVarName,
String defaultValue) |
static boolean |
isNotNullOrEmpty(Map map) |
static boolean |
isNotNullOrEmpty(String str) |
static boolean |
isNotNullOrEmpty(String[] array) |
static boolean |
isNullOrEmpty(String str) |
static String |
join(Object[] array) |
static String |
join(Object[] array,
char separator) |
static String |
randomString(int length) |
static String |
randomString(String prefix,
int length) |
static String |
replaceAllWithoutRegex(String text,
String from,
String to)
Replaces all occurrences of the from text with to text without any regular expressions
|
static boolean |
shutdownExecutorService(ExecutorService executorService)
Closes the specified
ExecutorService . |
static String |
toUrlEncoded(String str)
Converts string to URL encoded string.
|
static boolean |
waitUntilReady(BlockingQueue<Object> queue,
long amount,
TimeUnit timeUnit)
Wait until an other thread signals the completion of a task.
|
public static <T> T checkNotNull(T ref, String message)
public static String getSystemPropertyOrEnvVar(String systemPropertyName, String envVarName, String defaultValue)
public static String convertSystemPropertyNameToEnvVar(String systemPropertyName)
public static String getSystemPropertyOrEnvVar(String systemPropertyName, String defaultValue)
public static Boolean getSystemPropertyOrEnvVar(String systemPropertyName, Boolean defaultValue)
public static int getSystemPropertyOrEnvVar(String systemPropertyName, int defaultValue)
public static boolean waitUntilReady(BlockingQueue<Object> queue, long amount, TimeUnit timeUnit)
queue
- The communication channel.amount
- The amount of time to wait.timeUnit
- The time unit.public static boolean shutdownExecutorService(ExecutorService executorService)
ExecutorService
.executorService
- The executorService.public static void closeQuietly(Iterable<Closeable> closeables)
Closeable
items.public static void closeQuietly(Closeable... closeables)
Closeable
items.closeables
- An array of Closeable
items.public static String randomString(int length)
public static String replaceAllWithoutRegex(String text, String from, String to)
text
- text stringfrom
- from stringto
- to stringpublic static boolean isNullOrEmpty(String str)
public static boolean isNotNullOrEmpty(Map map)
public static boolean isNotNullOrEmpty(String str)
public static boolean isNotNullOrEmpty(String[] array)
public static String getProperty(Map<String,Object> properties, String propertyName, String defaultValue)
Copyright © 2015–2019 Red Hat. All rights reserved.