public class P6Util
extends java.lang.Object
Constructor and Description |
---|
P6Util() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Class<?> |
forName(java.lang.String name)
A utility for using the current class loader (rather than the
system class loader) when instantiating a new class.
|
static java.lang.String |
getPath(java.net.URL theURL) |
static java.util.Properties |
getProperties(java.util.Map<java.lang.String,java.lang.String> map) |
static java.util.Map<java.lang.String,java.lang.String> |
getPropertiesMap(java.util.Properties properties) |
static boolean |
isTrue(java.lang.String s,
boolean defaultValue) |
static java.lang.String |
joinNullSafe(java.util.Collection<java.lang.String> collection,
java.lang.String separator) |
static java.net.URL |
locateFile(java.lang.String file)
Locates a file on the file system or on the classpath.
|
static java.net.URL |
locateOnClassPath(java.lang.String filename)
Locates a file on the classpath.
|
static java.util.List<java.lang.String> |
parseCSVList(java.lang.String csv) |
static int |
parseInt(java.lang.String i,
int defaultValue) |
static java.lang.String |
singleLine(java.lang.String str) |
public static java.lang.String singleLine(java.lang.String str)
public static int parseInt(java.lang.String i, int defaultValue)
public static boolean isTrue(java.lang.String s, boolean defaultValue)
public static java.net.URL locateFile(java.lang.String file)
Search order:
file
- the relative path of the file to locatepublic static java.net.URL locateOnClassPath(java.lang.String filename)
filename
- the relative path of the file to loadpublic static java.lang.Class<?> forName(java.lang.String name) throws java.lang.ClassNotFoundException
The idea is that the thread's current loader might have an obscure notion of what your class path is (e.g. an app server) that will not be captured properly by the system class loader.
taken from http://sourceforge.net/forum/message.php?msg_id=1720229
name
- class name to loadjava.lang.ClassNotFoundException
public static java.lang.String getPath(java.net.URL theURL)
public static java.util.Map<java.lang.String,java.lang.String> getPropertiesMap(java.util.Properties properties)
properties
- to be converted to Map
.Map
of the properties. Please note, that properties that
have no value specified are contained in a result map, but with
value equal to "" (empty String
).public static java.util.List<java.lang.String> parseCSVList(java.lang.String csv)
public static java.util.Properties getProperties(java.util.Map<java.lang.String,java.lang.String> map)
public static java.lang.String joinNullSafe(java.util.Collection<java.lang.String> collection, java.lang.String separator)
collection
- to be joined elements.separator
- used in join.collections
elements joined via separator
.