class ContextFinder
extends java.lang.Object
JAXBContext
Modifier and Type | Field and Description |
---|---|
private static java.util.logging.Logger |
logger |
private static java.lang.String |
PLATFORM_DEFAULT_FACTORY_CLASS
When JAXB is in J2SE, rt.jar has to have a JAXB implementation.
|
Constructor and Description |
---|
ContextFinder() |
Modifier and Type | Method and Description |
---|---|
(package private) static JAXBContext |
find(java.lang.Class[] classes,
java.util.Map properties) |
(package private) static JAXBContext |
find(java.lang.String factoryId,
java.lang.String contextPath,
java.lang.ClassLoader classLoader,
java.util.Map properties) |
private static java.lang.ClassLoader |
getClassClassLoader(java.lang.Class c) |
private static java.lang.ClassLoader |
getContextClassLoader() |
private static java.lang.ClassLoader |
getSystemClassLoader() |
private static JAXBException |
handleClassCastException(java.lang.Class originalType,
java.lang.Class targetType)
Determine if two types (JAXBContext in this case) will generate a ClassCastException.
|
private static void |
handleInvocationTargetException(java.lang.reflect.InvocationTargetException x)
If the
InvocationTargetException wraps an exception that shouldn't be wrapped,
throw the wrapped exception. |
private static java.util.Properties |
loadJAXBProperties(java.lang.ClassLoader classLoader,
java.lang.String propFileName) |
private static java.lang.Class |
lookupJaxbContextUsingOsgiServiceLoader() |
(package private) static JAXBContext |
newInstance(java.lang.Class[] classes,
java.util.Map properties,
java.lang.Class spFactory) |
(package private) static JAXBContext |
newInstance(java.lang.Class[] classes,
java.util.Map properties,
java.lang.String className)
Create an instance of a class using the thread context ClassLoader
|
(package private) static JAXBContext |
newInstance(java.lang.String contextPath,
java.lang.Class spFactory,
java.lang.ClassLoader classLoader,
java.util.Map properties) |
(package private) static JAXBContext |
newInstance(java.lang.String contextPath,
java.lang.String className,
java.lang.ClassLoader classLoader,
java.util.Map properties)
Create an instance of a class using the specified ClassLoader
|
private static java.lang.Class |
safeLoadClass(java.lang.String className,
java.lang.ClassLoader classLoader)
Loads the class, provided that the calling thread has an access to the class being loaded.
|
(package private) static java.net.URL |
which(java.lang.Class clazz)
Get the URL for the Class from it's ClassLoader.
|
(package private) static java.net.URL |
which(java.lang.Class clazz,
java.lang.ClassLoader loader)
Search the given ClassLoader for an instance of the specified class and
return a string representation of the URL that points to the resource.
|
private static final java.util.logging.Logger logger
private static final java.lang.String PLATFORM_DEFAULT_FACTORY_CLASS
When the user bundles his own JAXB implementation, we'd like to use it, and we want the platform default to be used only when there's no other JAXB provider.
For this reason, we have to hard-code the class name into the API.
private static void handleInvocationTargetException(java.lang.reflect.InvocationTargetException x) throws JAXBException
InvocationTargetException
wraps an exception that shouldn't be wrapped,
throw the wrapped exception.JAXBException
private static JAXBException handleClassCastException(java.lang.Class originalType, java.lang.Class targetType)
originalType
- The Class object of the type being casttargetType
- The Class object of the type that is being cast tostatic JAXBContext newInstance(java.lang.String contextPath, java.lang.String className, java.lang.ClassLoader classLoader, java.util.Map properties) throws JAXBException
JAXBException
static JAXBContext newInstance(java.lang.String contextPath, java.lang.Class spFactory, java.lang.ClassLoader classLoader, java.util.Map properties) throws JAXBException
JAXBException
static JAXBContext newInstance(java.lang.Class[] classes, java.util.Map properties, java.lang.String className) throws JAXBException
JAXBException
static JAXBContext newInstance(java.lang.Class[] classes, java.util.Map properties, java.lang.Class spFactory) throws JAXBException
JAXBException
static JAXBContext find(java.lang.String factoryId, java.lang.String contextPath, java.lang.ClassLoader classLoader, java.util.Map properties) throws JAXBException
JAXBException
static JAXBContext find(java.lang.Class[] classes, java.util.Map properties) throws JAXBException
JAXBException
private static java.lang.Class lookupJaxbContextUsingOsgiServiceLoader()
private static java.util.Properties loadJAXBProperties(java.lang.ClassLoader classLoader, java.lang.String propFileName) throws JAXBException
JAXBException
static java.net.URL which(java.lang.Class clazz, java.lang.ClassLoader loader)
clazz
- The class to search forloader
- The ClassLoader to search. If this parameter is null, then the
system class loader will be searchedstatic java.net.URL which(java.lang.Class clazz)
which(Class, ClassLoader)
.
Equivalent to calling: which(clazz, clazz.getClassLoader())clazz
- The class to search forprivate static java.lang.Class safeLoadClass(java.lang.String className, java.lang.ClassLoader classLoader) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
private static java.lang.ClassLoader getContextClassLoader()
private static java.lang.ClassLoader getClassClassLoader(java.lang.Class c)
private static java.lang.ClassLoader getSystemClassLoader()