Modifier and Type | Class and Description |
---|---|
static interface |
Util.RetryOperator<T> |
Modifier and Type | Field and Description |
---|---|
static String |
CONVERT_DOT_TO_PDF
On OS X only, and if the graphviz dot binary is installed, when true, dot will be invoked to convert the dot file
to a pdf document.
|
static boolean |
HAS_DOT_EXEC |
static int |
ID_LENGTH |
static boolean |
IS_OSX |
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static Set<Class<? extends Exception>> |
asClasses(String classNames,
String warningMessage)
Converts a given comma separated String of Exception names into a List of classes.
|
static String |
cleansePathName(String name) |
static <T> boolean |
contains(Class<T> type,
Collection collection) |
static <T> boolean |
contains(Class<T> type,
Iterator iterator) |
static boolean |
containsNull(Object[] values) |
static boolean |
containsWhitespace(String string) |
static <T> T[] |
copy(T[] source) |
static <K,V> HashMap<K,V> |
createHashMap() |
static String |
createID(byte[] bytes)
Method CreateID returns a HEX hash of the given bytes with length 32 characters long.
|
static String |
createID(String rawID) |
static <V> Set<V> |
createIdentitySet() |
static <V> Set<V> |
createIdentitySet(Collection<V> collection) |
static Object |
createProtectedObject(Class type,
Object[] parameters,
Class[] parameterTypes) |
static String |
createUniqueID() |
static String |
createUniqueIDWhichStartsWithAChar() |
static <T> Set<T> |
differenceIdentity(Set<T> lhs,
Set<T> rhs) |
static int |
execProcess(File parentFile,
String... command) |
static String |
findContainingJar(Class<?> type) |
static Class |
findMainClass(Class defaultType,
String packageExclude) |
static String |
findName(String path) |
static String |
findVersion(String path) |
static String |
formatDurationDHMSms(long duration) |
static String |
formatDurationFromMillis(long duration) |
static String |
formatDurationHMSms(long duration) |
static String |
formatDurationMSms(long duration) |
static <V> V |
getFirst(Collection<V> collection) |
static <V> V |
getFirst(Iterator<V> iterator) |
static String |
getHex(byte[] bytes) |
static <V> V |
getLast(Iterator<V> iterator) |
static String |
getSimpleTypeName(Type type) |
static long |
getSinkModified(Object config,
Collection<Tap> sinks) |
static long |
getSourceModified(Object confCopy,
Iterator<Tap> values,
long sinkModified) |
static String |
getTypeName(Type type) |
static boolean |
hasClass(String typeString) |
static boolean |
hasInstanceMethod(Object target,
String methodName,
Class[] parameterTypes) |
static byte[] |
intToByteArray(int value) |
static <T> T |
invokeConstructor(Class<T> target,
Object[] parameters,
Class[] parameterTypes) |
static Object |
invokeConstructor(String className,
Object[] parameters,
Class[] parameterTypes) |
static Object |
invokeInstanceMethod(Object target,
String methodName,
Object[] parameters,
Class[] parameterTypes) |
static Object |
invokeInstanceMethodSafe(Object target,
String methodName,
Object[] parameters,
Class[] parameterTypes) |
static Object |
invokeStaticMethod(Class type,
String methodName,
Object[] parameters,
Class[] parameterTypes) |
static Object |
invokeStaticMethod(String typeString,
String methodName,
Object[] parameters,
Class[] parameterTypes) |
static boolean |
isEmpty(String string) |
static String |
join(Collection collection)
This method joins each value in the collection with a tab character as the delimiter.
|
static String |
join(Collection collection,
String delim)
This method joins each valuein the collection with the given delimiter.
|
static String |
join(Collection collection,
String delim,
boolean printNull) |
static String |
join(int[] list,
String delim)
This method joins the values in the given list with the delim String value.
|
static String |
join(int[] list,
String delim,
boolean printNull) |
static String |
join(Iterable iterable,
String delim,
boolean printNull) |
static String |
join(Object[] list,
String delim)
This method joins the values in the given list with the delim String value.
|
static String |
join(Object[] list,
String delim,
boolean printNull) |
static String |
join(Object[] list,
String delim,
boolean printNull,
int beginAt) |
static String |
join(Object[] list,
String delim,
boolean printNull,
int beginAt,
int length) |
static String |
join(String delim,
boolean printNull,
String... strings) |
static void |
join(StringBuffer buffer,
Collection collection,
String delim)
This method joins each value in the collection with the given delimiter.
|
static void |
join(StringBuffer buffer,
Collection collection,
String delim,
boolean printNull) |
static String |
join(String delim,
String... strings) |
static Class<?> |
loadClass(String typeString) |
static Class<?> |
loadClassSafe(String typeString) |
static byte[] |
longToByteArray(long value) |
static String |
makePath(String prefix,
String name) |
static <N extends Number> |
max(Collection<N> collection) |
static <N extends Number> |
min(Collection<N> collection) |
static <T> Set<T> |
narrowIdentitySet(Class<T> type,
Collection collection) |
static <T> Set<T> |
narrowIdentitySet(Class<T> type,
Collection collection,
boolean include) |
static <T> Set<T> |
narrowIdentitySet(Class<T> type,
Iterator iterator) |
static <T> Set<T> |
narrowIdentitySet(Class<T> type,
Iterator iterator,
boolean include) |
static <T> Set<T> |
narrowSet(Class<T> type,
Collection collection) |
static <T> Set<T> |
narrowSet(Class<T> type,
Collection collection,
boolean include) |
static <T> Set<T> |
narrowSet(Class<T> type,
Iterator iterator) |
static <T> Set<T> |
narrowSet(Class<T> type,
Iterator iterator,
boolean include) |
static <T> T |
newInstance(Class<T> target,
Object... parameters) |
static <T> T |
newInstance(String className,
Object... parameters) |
static String |
normalizeUrl(String url)
This method attempts to remove duplicate consecutive forward slashes from the given url.
|
static String |
parseHostname(String uri) |
static String |
print(Collection collection,
String delim) |
static void |
print(StringBuffer buffer,
Collection collection,
String delim) |
static void |
printGraph(String filename,
org.jgrapht.graph.SimpleDirectedGraph graph) |
static Collection<String> |
quote(Collection<String> collection,
String quote) |
static void |
removeAllNulls(List list)
This method removes all nulls from the given List.
|
static String[] |
removeNulls(String... strings) |
static <T> T |
retry(org.slf4j.Logger logger,
int retries,
int secondsDelay,
String message,
Util.RetryOperator<T> operator) |
static <R> R |
returnInstanceFieldIfExists(Object target,
String fieldName) |
static <R> R |
returnInstanceFieldIfExistsSafe(Object target,
String fieldName) |
static <K,V> boolean |
reverseMap(Map<V,K> from,
Map<K,V> to) |
static void |
safeSleep(long durationMillis) |
static String |
sanitizeUrl(String url)
This method attempts to remove any username and password from the given url String.
|
static <R> void |
setInstanceFieldIfExists(Object target,
String fieldName,
R value) |
static <R> boolean |
setInstanceFieldIfExistsSafe(Object target,
String fieldName,
R value) |
static String[] |
simpleTypeNames(Type[] types) |
static <T> List<T> |
split(Class<T> type,
String values) |
static <T> List<T> |
split(Class<T> type,
String delim,
String values) |
static Boolean |
submitWithTimeout(Callable<Boolean> task,
int timeout,
TimeUnit timeUnit) |
static String |
toNull(Object object)
This method returns the
Object.toString() of the given object, or an empty String if the object
is null. |
static String |
truncate(String string,
int maxSize)
This method truncates the given String value to the given size, but appends an ellipse ("...") if the
String is larger than maxSize.
|
static String[] |
typeNames(Type[] types) |
static String |
unique(String value,
String delim) |
static void |
writeDOT(Writer writer,
org.jgrapht.DirectedGraph graph,
IntegerNameProvider vertexIdProvider,
VertexNameProvider vertexNameProvider,
EdgeNameProvider edgeNameProvider) |
static void |
writeDOT(Writer writer,
org.jgrapht.DirectedGraph graph,
IntegerNameProvider vertexIdProvider,
VertexNameProvider vertexNameProvider,
EdgeNameProvider edgeNameProvider,
ComponentAttributeProvider vertexAttributeProvider,
ComponentAttributeProvider edgeAttributeProvider) |
static void |
writePDF(String path) |
public static final String CONVERT_DOT_TO_PDF
public static int ID_LENGTH
public static final boolean IS_OSX
public static final boolean HAS_DOT_EXEC
public Util()
public static <K,V> HashMap<K,V> createHashMap()
public static <K,V> boolean reverseMap(Map<V,K> from, Map<K,V> to)
public static <V> Set<V> createIdentitySet()
public static <V> Set<V> createIdentitySet(Collection<V> collection)
public static <V> V getFirst(Collection<V> collection)
public static <N extends Number> N max(Collection<N> collection)
public static <N extends Number> N min(Collection<N> collection)
public static <T> Set<T> narrowSet(Class<T> type, Collection collection)
public static <T> Set<T> narrowIdentitySet(Class<T> type, Collection collection)
public static <T> Set<T> narrowSet(Class<T> type, Collection collection, boolean include)
public static <T> Set<T> narrowIdentitySet(Class<T> type, Collection collection, boolean include)
public static <T> Set<T> narrowIdentitySet(Class<T> type, Iterator iterator)
public static <T> Set<T> narrowIdentitySet(Class<T> type, Iterator iterator, boolean include)
public static <T> boolean contains(Class<T> type, Collection collection)
public static <T> Set<T> differenceIdentity(Set<T> lhs, Set<T> rhs)
public static String createUniqueIDWhichStartsWithAChar()
public static String createUniqueID()
public static String createID(byte[] bytes)
bytes
- the bytespublic static byte[] longToByteArray(long value)
public static byte[] intToByteArray(int value)
public static <T> T[] copy(T[] source)
public static String join(int[] list, String delim)
list
- delim
- public static String join(Object[] list, String delim)
list
- delim
- public static String join(Object[] list, String delim, boolean printNull, int beginAt, int length)
public static String join(Collection collection)
collection
- public static String join(Collection collection, String delim)
collection
- delim
- public static String join(Collection collection, String delim, boolean printNull)
public static void join(StringBuffer buffer, Collection collection, String delim)
StringBuffer
instance.buffer
- collection
- delim
- public static void join(StringBuffer buffer, Collection collection, String delim, boolean printNull)
public static String[] removeNulls(String... strings)
public static Collection<String> quote(Collection<String> collection, String quote)
public static String print(Collection collection, String delim)
public static void print(StringBuffer buffer, Collection collection, String delim)
public static String sanitizeUrl(String url)
url
- public static String normalizeUrl(String url)
url
- public static String toNull(Object object)
Object.toString()
of the given object, or an empty String if the object
is null.object
- public static String truncate(String string, int maxSize)
string
- maxSize
- public static void printGraph(String filename, org.jgrapht.graph.SimpleDirectedGraph graph)
public static void removeAllNulls(List list)
list
- public static void writeDOT(Writer writer, org.jgrapht.DirectedGraph graph, IntegerNameProvider vertexIdProvider, VertexNameProvider vertexNameProvider, EdgeNameProvider edgeNameProvider)
public static void writeDOT(Writer writer, org.jgrapht.DirectedGraph graph, IntegerNameProvider vertexIdProvider, VertexNameProvider vertexNameProvider, EdgeNameProvider edgeNameProvider, ComponentAttributeProvider vertexAttributeProvider, ComponentAttributeProvider edgeAttributeProvider)
public static String findVersion(String path)
public static long getSourceModified(Object confCopy, Iterator<Tap> values, long sinkModified) throws IOException
IOException
public static long getSinkModified(Object config, Collection<Tap> sinks) throws IOException
IOException
public static String getTypeName(Type type)
public static String getSimpleTypeName(Type type)
public static String[] simpleTypeNames(Type[] types)
public static boolean containsNull(Object[] values)
public static void safeSleep(long durationMillis)
public static int execProcess(File parentFile, String... command)
public static String formatDurationFromMillis(long duration)
public static String formatDurationMSms(long duration)
public static String formatDurationHMSms(long duration)
public static String formatDurationDHMSms(long duration)
public static Set<Class<? extends Exception>> asClasses(String classNames, String warningMessage)
classNames
- A comma separated String of Exception names.public static Boolean submitWithTimeout(Callable<Boolean> task, int timeout, TimeUnit timeUnit) throws Exception
Exception
public static <T> T retry(org.slf4j.Logger logger, int retries, int secondsDelay, String message, Util.RetryOperator<T> operator) throws Exception
Exception
public static Object createProtectedObject(Class type, Object[] parameters, Class[] parameterTypes)
public static <T> T newInstance(String className, Object... parameters)
public static <T> T newInstance(Class<T> target, Object... parameters)
public static Object invokeStaticMethod(String typeString, String methodName, Object[] parameters, Class[] parameterTypes)
public static Class<?> loadClassSafe(String typeString)
public static Object invokeStaticMethod(Class type, String methodName, Object[] parameters, Class[] parameterTypes)
public static boolean hasInstanceMethod(Object target, String methodName, Class[] parameterTypes)
public static Object invokeInstanceMethodSafe(Object target, String methodName, Object[] parameters, Class[] parameterTypes)
public static Object invokeInstanceMethod(Object target, String methodName, Object[] parameters, Class[] parameterTypes)
public static <R> R returnInstanceFieldIfExistsSafe(Object target, String fieldName)
public static Object invokeConstructor(String className, Object[] parameters, Class[] parameterTypes)
public static <T> T invokeConstructor(Class<T> target, Object[] parameters, Class[] parameterTypes)
public static <R> R returnInstanceFieldIfExists(Object target, String fieldName)
public static <R> boolean setInstanceFieldIfExistsSafe(Object target, String fieldName, R value)
public static <R> void setInstanceFieldIfExists(Object target, String fieldName, R value)
public static String cleansePathName(String name)
public static Class findMainClass(Class defaultType, String packageExclude)
public static String findContainingJar(Class<?> type)
public static boolean containsWhitespace(String string)
public static String parseHostname(String uri)
Copyright © 2007-2015 Concurrent, Inc. All Rights Reserved.