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 |
convertSystemPropertyNameToEnvVar(String systemPropertyName) |
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(String str) |
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 occurrencies of the from text with to text without any regular expressions
|
static boolean |
shutdownExecutorService(ExecutorService executorService)
Closes the specified
ExecutorService . |
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 boolean isNullOrEmpty(String str)
public static boolean isNotNullOrEmpty(String str)
public static String getProperty(Map<String,Object> properties, String propertyName, String defaultValue)
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 replaceAllWithoutRegex(String text, String from, String to)
public static String randomString(int length)
Copyright © 2015–2017 Red Hat. All rights reserved.