Top Description Fields Constructors Methods
org.glassfish.jaxb.runtime.v2

public Class ContextFactory

extends Object
Class Inheritance
Imports
com.sun.istack.FinalArrayList, org.glassfish.jaxb.core.Utils, org.glassfish.jaxb.runtime.api.JAXBRIContext, .TypeReference, org.glassfish.jaxb.runtime.v2.model.annotation.RuntimeAnnotationReader, org.glassfish.jaxb.core.v2.Messages, org.glassfish.jaxb.runtime.v2.runtime.JAXBContextImpl, org.glassfish.jaxb.runtime.v2.util.TypeCast, jakarta.xml.bind.JAXBContext, .JAXBException, java.io.BufferedReader, .IOException, .InputStream, .InputStreamReader, java.nio.charset.StandardCharsets, java.util.*, java.util.logging.Level

This class is responsible for producing RI JAXBContext objects.

Used to create JAXBContext objects for v1.0.1 and forward

Author
Kohsuke Kawaguchi
Since
2.0

Field Summary

Modifier and TypeField and Description
public static final String

Constructor Summary

AccessConstructor and Description
private
ContextFactory()

Private constructor.

Method Summary

Modifier and TypeMethod and Description
public static JAXBContext
createContext(Class<T>[] classes, Map<String, Object> properties)

The API will invoke this method via reflection

public static JAXBRIContext
createContext(Class<T>[] classes, Collection<TypeReference> typeRefs, Map<Class<T>, Class<T>> subclassReplacements, String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo)
Deprecated use createContext(Class[] classes, Map<String,Object> properties) method instead

public static JAXBRIContext
createContext(Class<T>[] classes, Collection<TypeReference> typeRefs, Map<Class<T>, Class<T>> subclassReplacements, String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean improvedXsiTypeHandling)
Deprecated use createContext( Class[] classes, Map<String,Object> properties) method instead

public static JAXBContext
createContext(String contextPath, ClassLoader classLoader, Map<String, Object> properties)

The API will invoke this method via reflection.

private static <T> T
getPropertyValue(Map<String, Object> properties, String keyName, Class<T> type)

If a key is present in the map, remove the value and return it.

private static List<Class<T>>

Returns:

a List of Class objects to load, null if there weren't any
loadIndexedClasses
(String
package name to search in
pkg
,
ClassLoader
ClassLoader to search in
classLoader
)

Look for jaxb.index file in the specified package and load it's contents

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

USE_JAXB_PROPERTIESback to summary
public static final String USE_JAXB_PROPERTIES

Constructor Detail

ContextFactoryback to summary
private ContextFactory()

Private constructor.

Method Detail

createContextback to summary
public static JAXBContext createContext(Class<T>[] classes, Map<String, Object> properties) throws JAXBException

The API will invoke this method via reflection

createContextback to summary
public static JAXBRIContext createContext(Class<T>[] classes, Collection<TypeReference> typeRefs, Map<Class<T>, Class<T>> subclassReplacements, String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo) throws JAXBException

Deprecated

use createContext(Class[] classes, Map<String,Object> properties) method instead

Annotations
@Deprecated
createContextback to summary
public static JAXBRIContext createContext(Class<T>[] classes, Collection<TypeReference> typeRefs, Map<Class<T>, Class<T>> subclassReplacements, String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean improvedXsiTypeHandling) throws JAXBException

Deprecated

use createContext( Class[] classes, Map<String,Object> properties) method instead

Annotations
@Deprecated
createContextback to summary
public static JAXBContext createContext(String contextPath, ClassLoader classLoader, Map<String, Object> properties) throws JAXBException

The API will invoke this method via reflection.

getPropertyValueback to summary
private static <T> T getPropertyValue(Map<String, Object> properties, String keyName, Class<T> type) throws JAXBException

If a key is present in the map, remove the value and return it.

loadIndexedClassesback to summary
private static List<Class<T>> loadIndexedClasses(String pkg, ClassLoader classLoader) throws IOException, JAXBException

Look for jaxb.index file in the specified package and load it's contents

Parameters
pkg:String

package name to search in

classLoader:ClassLoader

ClassLoader to search in

Returns:List<Class<T>>

a List of Class objects to load, null if there weren't any

Exceptions
IOException:
if there is an error reading the index file
JAXBException:
if there are any errors in the index file