public class P6Util extends Object
Constructor and Description |
---|
P6Util() |
Modifier and Type | Method and Description |
---|---|
static Class<?> |
forName(String name)
A utility for using the current class loader (rather than the
system class loader) when instantiating a new class.
|
static String |
getPath(URL theURL) |
static Properties |
getProperties(Map<String,String> map) |
static Map<String,String> |
getPropertiesMap(Properties properties) |
static boolean |
isTrue(String s,
boolean defaultValue) |
static String |
joinNullSafe(Collection<String> collection,
String separator) |
static URL |
locateFile(String file)
Locates a file on the file system or on the classpath.
|
static URL |
locateOnClassPath(String filename)
Locates a file on the classpath.
|
static List<String> |
parseCSVList(String csv) |
static int |
parseInt(String i,
int defaultValue) |
static String |
singleLine(String str) |
public static int parseInt(String i, int defaultValue)
public static boolean isTrue(String s, boolean defaultValue)
public static URL locateFile(String file)
Search order:
file
- the relative path of the file to locatepublic static URL locateOnClassPath(String filename)
filename
- the relative path of the file to loadpublic static Class<?> forName(String name) throws 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 loadClassNotFoundException
public static Map<String,String> getPropertiesMap(Properties properties)
public static Properties getProperties(Map<String,String> map)
public static String joinNullSafe(Collection<String> collection, String separator)
collection
- to be joined elements.separator
- used in join.collections
elements joined via separator
.Copyright © 2002-2014 P6Spy. All Rights Reserved.