public final class ResolveHelpers extends Object
Modifier and Type | Method and Description |
---|---|
static ClassLoader |
getClassLoader(ClassLoader loader)
Gets the
ClassLoader that's actually to be used (e.g. |
static String |
getPackageName(String className)
Gets the package name of the given class name.
|
static String |
getQualifiedFileName(String fileName,
String packageName)
Qualifies the given
fileName with the given
packageName and returns the resulting file path.If packageName is null or a zero-length
String, this method will return fileName . |
static Class |
loadClass(ClassLoader classLoader,
String className)
Capsulates the ClassLoader.loadClass method to throw no exceptions but return null
instead.
|
static boolean |
namespaceEquals(String ns1,
String ns2)
Compares the two strings for equality.
|
public static String getQualifiedFileName(String fileName, String packageName)
fileName
with the given
packageName
and returns the resulting file path.packageName
is null
or a zero-length
String, this method will return fileName
.fileName
- The file name to be qualified.packageName
- The package name to be used for qualifying.public static String getPackageName(String className)
className
- The class name to retrieve the package name from.className
is null
or does not contain a package.public static boolean namespaceEquals(String ns1, String ns2)
public static ClassLoader getClassLoader(ClassLoader loader)
ClassLoader
that's actually to be used (e.g. for
loading resources).ClassLoader
is determined in the following way:
null
, it
is used.
null
,
it is used.
loader
- The "preferred" ClassLoader
.public static Class loadClass(ClassLoader classLoader, String className)
classLoader
- the class loader to useclassName
- the class to loadCopyright © 2013. All rights reserved.