public class Utils extends Object
Modifier and Type | Method and Description |
---|---|
static double[] |
expandArrayFromTheBeginning(double[] inputArray,
int desiredLength)
Given an input array and wanted size, it extends the length of the array by filling up
values of 0 in the beginning of the array.
|
static ClassLoader |
getContextOrCruiseControlClassLoader()
Get the Context ClassLoader on this thread or, if not present, the ClassLoader that
loaded Kafka.
|
static ClassLoader |
getCruiseControlClassLoader()
Get the ClassLoader which loaded Kafka.
|
static <T> String |
join(Collection<T> list,
String separator)
Create a string representation of a list joined by the given separator
|
static <T> T |
newInstance(Class<T> c)
Instantiate the class
|
static <T> T |
newInstance(String klass,
Class<T> base)
Look up the class by name and instantiate it.
|
public static <T> T newInstance(Class<T> c) throws CruiseControlException
CruiseControlException
public static <T> T newInstance(String klass, Class<T> base) throws ClassNotFoundException, CruiseControlException
T
- klass
- class namebase
- super class of the class to be instantiatedClassNotFoundException
CruiseControlException
public static ClassLoader getContextOrCruiseControlClassLoader()
public static ClassLoader getCruiseControlClassLoader()
public static <T> String join(Collection<T> list, String separator)
list
- The list of itemsseparator
- The separatorpublic static double[] expandArrayFromTheBeginning(double[] inputArray, int desiredLength)
Example: Given an input array [5, 20, 40] and a desired length of 5, we'd receive as output the array [0, 0, 5, 20, 40].
inputArray
- to extenddesiredLength
- the wanted size, it should be greater than the size of the input arrayIllegalArgumentException
- if the desired length is less or equal to the input array's size