public class Util extends Object
| Constructor and Description |
|---|
Util() |
| Modifier and Type | Method and Description |
|---|---|
static <T> String |
commaSeparate(Collection<T> list)
Convert a list of elements to a single comma separated string.
|
static <T> String |
delimiterSeparate(Collection<T> list,
String delimiter)
Convert a list of elements to a single delimiter separated string.
|
static Collection<String> |
expandWildcard(Collection<String> pathOrPatterns)
Expand glob file patterns to path strings.
|
static String |
firstCharLowerCase(String s)
Make the first character lower case.
|
static String |
firstCharUpperCase(String s)
Make the first character upper case.
|
static void |
forceMkdirParent(File file)
Makes any necessary but nonexistent parent directories for a given File.
|
static Collection<UserType> |
getAllUserTypes(Collection<Schema> schemas)
Get a set of all user types defined in all schemas.
|
static String |
getNewLine()
Get a new line character.
|
static Class<?> |
loadClass(String name,
String classpath)
Load a Java class by it's full name.
|
static Class<?> |
loadClass(String name,
URL[] urls)
Load a Java class by it's full name.
|
static URL[] |
parseClassPath(String classpath)
Parse a Java
classpath string to URLs. |
static String |
toNameSpace(String fullName)
Extract name space from a full qualified type name.
|
static String |
toShortName(String fullName)
Extract short name from a full qualified type name.
|
public static <T> String commaSeparate(Collection<T> list)
list - the collection of values to join together.public static <T> String delimiterSeparate(Collection<T> list, String delimiter)
list - the collection of values to join together.delimiter - the delimiter that separates values.public static String firstCharLowerCase(String s)
The input string must at least has 2 characters.
s - the input string value.public static String firstCharUpperCase(String s)
The input string must at least has 2 characters.
s - the input string value.public static String toShortName(String fullName)
The full name has the format of namespace.typename.
fullName - full type name.public static String toNameSpace(String fullName)
The full name has the format of namespace.typename.
fullName - full type name.public static String getNewLine()
public static Collection<UserType> getAllUserTypes(Collection<Schema> schemas)
schemas - A collection of Tesla schema objects.public static Collection<String> expandWildcard(Collection<String> pathOrPatterns) throws IOException
pathOrPatterns - glob patterns.IOException - On IO errors.public static URL[] parseClassPath(String classpath) throws IOException
classpath string to URLs. The classpath is represented with the same format of the
CLASSPATH variable or -cp java option. It supports the * wildcard.classpath - the classpath string.IOException - on IO errors.public static Class<?> loadClass(String name, String classpath) throws ClassNotFoundException, IOException
name - The full name of the Java class to load.classpath - The class paths or jar files from where the Java class be
loaded. If this is null or empty string. loadClass
will try to load from JVM classpath instead.ClassNotFoundException - If the class is not found.IOException - If the jar file cannot open.public static Class<?> loadClass(String name, URL[] urls) throws ClassNotFoundException, IOException
name - The full name of the Java class to load.urls - An array of URL objects represent class paths or jar files.ClassNotFoundException - If the class is not found.IOException - If the jar file cannot open.public static void forceMkdirParent(File file) throws IOException
Workaround for FileUtils.forceMkdirParent in Apache Commons IO 2.5.
file - file with parent to create, must not be nullNullPointerException - if the file is nullIOException - if the parent directory cannot be createdCopyright © 2015. All Rights Reserved.