Class ResolveHelpers
java.lang.Object
org.exolab.castor.xml.util.resolvers.ResolveHelpers
Some helpers used by the resolver commands. This is a utility class which
is NOT meant to be instantiated.
- Since:
- 1.2
- Version:
- $Revision$ $Date$
- Author:
- Joachim Grueneis
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClassLoadergetClassLoader(ClassLoader loader) Gets theClassLoaderthat's actually to be used (e.g.static StringgetPackageName(String className) Gets the package name of the given class name.static StringgetQualifiedFileName(String fileName, String packageName) Qualifies the givenfileNamewith the givenpackageNameand returns the resulting file path.
IfpackageNameisnullor a zero-length String, this method will returnfileName.static ClassloadClass(ClassLoader classLoader, String className) Capsulates the ClassLoader.loadClass method to throw no exceptions but return null instead.static booleannamespaceEquals(String ns1, String ns2) Compares the two strings for equality.
-
Method Details
-
getQualifiedFileName
Qualifies the givenfileNamewith the givenpackageNameand returns the resulting file path.
IfpackageNameisnullor a zero-length String, this method will returnfileName.- Parameters:
fileName- The file name to be qualified.packageName- The package name to be used for qualifying.- Returns:
- The qualified file path.
-
getPackageName
-
namespaceEquals
-
getClassLoader
Gets theClassLoaderthat's actually to be used (e.g. for loading resources).
The actualClassLoaderis determined in the following way:- If the passed in "preferred" loader is not
null, it is used.- If the loader of this XMLClassDescriptor is not
null, it is used.- The context class loader of the current thread is used.
- Parameters:
loader- The "preferred"ClassLoader.- Returns:
- The loader to be used.
- If the passed in "preferred" loader is not
-
loadClass
Capsulates the ClassLoader.loadClass method to throw no exceptions but return null instead. Any exception caught are logged with info severity.- Parameters:
classLoader- the class loader to useclassName- the class to load- Returns:
- the loaded Class or null
-