Class Utils
java.lang.Object
io.fabric8.kubernetes.client.utils.Utils
public class Utils extends Object
-
Method Summary
Modifier and Type Method Description static <T> TcheckNotNull(T ref, String message)static voidcloseQuietly(Closeable... closeables)Closes and flushes the specifiedCloseableitems.static voidcloseQuietly(Iterable<Closeable> closeables)Closes and flushes the specifiedCloseableitems.static Stringcoalesce(String... items)static StringconvertSystemPropertyNameToEnvVar(String systemPropertyName)static StringfilePath(URL path)static StringgetAnnotationValue(Class kubernetesResourceType, Class annotationClass)static StringgetEnvVar(String envVarName, String defaultValue)static StringgetPluralFromKind(String kind)static StringgetProperty(Map<String,Object> properties, String propertyName)static StringgetProperty(Map<String,Object> properties, String propertyName, String defaultValue)static StringgetSystemPropertyOrEnvVar(String systemPropertyName)static intgetSystemPropertyOrEnvVar(String systemPropertyName, int defaultValue)static booleangetSystemPropertyOrEnvVar(String systemPropertyName, Boolean defaultValue)static StringgetSystemPropertyOrEnvVar(String systemPropertyName, String defaultValue)static StringgetSystemPropertyOrEnvVar(String systemPropertyName, String envVarName, String defaultValue)static StringinterpolateString(String templateInput, Map<String,String> valuesMap)Interpolates a String containing variable placeholders with the values provided in the valuesMap.static <T> booleanisNotNull(T... refList)static booleanisNotNullOrEmpty(String str)static booleanisNotNullOrEmpty(String[] array)static booleanisNotNullOrEmpty(Map map)static booleanisNullOrEmpty(String str)static booleanisResourceNamespaced(Class kubernetesResourceType)Reads @Namespaced annotation in resource class to check whether resource is namespaced or notstatic Stringjoin(Object[] array)static Stringjoin(Object[] array, char separator)static StringrandomString(int length)static StringrandomString(String prefix, int length)static StringreplaceAllWithoutRegex(String text, String from, String to)Replaces all occurrences of the from text with to text without any regular expressionsstatic booleanshutdownExecutorService(ExecutorService executorService)Closes the specifiedExecutorService.static StringtoUrlEncoded(String str)Converts string to URL encoded string.static booleanwaitUntilReady(BlockingQueue<Object> queue, long amount, TimeUnit timeUnit)Wait until an other thread signals the completion of a task.
-
Method Details
-
checkNotNull
-
getSystemPropertyOrEnvVar
-
convertSystemPropertyNameToEnvVar
-
getEnvVar
-
getSystemPropertyOrEnvVar
-
getSystemPropertyOrEnvVar
-
getSystemPropertyOrEnvVar
-
getSystemPropertyOrEnvVar
-
join
-
join
-
waitUntilReady
Wait until an other thread signals the completion of a task. If an exception is passed, it will be propagated to the caller.- Parameters:
queue- The communication channel.amount- The amount of time to wait.timeUnit- The time unit.- Returns:
- a boolean value indicating resource is ready or not.
-
shutdownExecutorService
Closes the specifiedExecutorService.- Parameters:
executorService- The executorService.- Returns:
- True if shutdown is complete.
-
closeQuietly
Closes and flushes the specifiedCloseableitems. -
closeQuietly
Closes and flushes the specifiedCloseableitems.- Parameters:
closeables- An array ofCloseableitems.
-
coalesce
-
randomString
-
randomString
-
filePath
-
replaceAllWithoutRegex
Replaces all occurrences of the from text with to text without any regular expressions- Parameters:
text- text stringfrom- from stringto- to string- Returns:
- returns processed string
-
isNullOrEmpty
-
isNotNullOrEmpty
-
isNotNullOrEmpty
-
isNotNullOrEmpty
-
isNotNull
public static <T> boolean isNotNull(T... refList) -
getProperty
-
getProperty
-
toUrlEncoded
Converts string to URL encoded string.- Parameters:
str- Url as string- Returns:
- returns encoded string
-
getPluralFromKind
-
isResourceNamespaced
Reads @Namespaced annotation in resource class to check whether resource is namespaced or not- Parameters:
kubernetesResourceType- class for resource- Returns:
- boolean value indicating it's namespaced or not
-
getAnnotationValue
-
interpolateString
Interpolates a String containing variable placeholders with the values provided in the valuesMap.This method is intended to interpolate templates loaded from YAML and JSON files.
Placeholders are indicated by the dollar sign and curly braces (
${VARIABLE_KEY}).Placeholders can also be indicated by the dollar sign and double curly braces (
${{VARIABLE_KEY}}), when this notation is used, the resulting value will be unquoted (if applicable), expected values should be JSON compatible.- Parameters:
valuesMap- to interpolate in the StringtemplateInput- raw input containing a String with placeholders ready to be interpolated- Returns:
- the interpolated String
- See Also:
- OpenShift Templates
-