Package jakarta.xml.bind
Interface JAXBContextFactory
-
public interface JAXBContextFactoryFactory that creates new
JAXBContextinstances. JAXBContextFactory can be located usingServiceLoader.load(Class)- Since:
- 9, JAXB 2.3
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JAXBContextcreateContext(Class<?>[] classesToBeBound, Map<String,?> properties)Create a new instance of aJAXBContextclass.JAXBContextcreateContext(String contextPath, ClassLoader classLoader, Map<String,?> properties)Create a new instance of aJAXBContextclass.
-
-
-
Method Detail
-
createContext
JAXBContext createContext(Class<?>[] classesToBeBound, Map<String,?> properties) throws JAXBException
Create a new instance of a
JAXBContextclass.For semantics see
JAXBContext.newInstance(Class[], java.util.Map)- Parameters:
classesToBeBound- List of java classes to be recognized by the newJAXBContext. Classes inclassesToBeBoundthat are in named modules must be in a package that isopento at least thejakarta.xml.bindmodule. Can be empty, in which case aJAXBContextthat only knows about spec-defined classes will be returned.properties- provider-specific properties. Can be null, which means the same thing as passing in an empty map.- Returns:
- A new instance of a
JAXBContext. - Throws:
JAXBException- if an error was encountered while creating theJAXBContext, such as (but not limited to):- No Jakarta XML Binding implementation was discovered
- Classes use Jakarta XML Binding annotations incorrectly
- Classes have colliding annotations (i.e., two classes with the same type name)
- The Jakarta XML Binding implementation was unable to locate provider-specific out-of-band information (such as additional files generated at the development time.)
classesToBeBoundare not open tojakarta.xml.bindmodule
IllegalArgumentException- if the parameter containsnull(i.e.,newInstance(null,someMap);)- Since:
- 9, JAXB 2.3
-
createContext
JAXBContext createContext(String contextPath, ClassLoader classLoader, Map<String,?> properties) throws JAXBException
Create a new instance of a
JAXBContextclass.For semantics see
JAXBContext.newInstance(String, ClassLoader, java.util.Map)The interpretation of properties is up to implementations. Implementations must throw
JAXBExceptionif it finds properties that it doesn't understand.- Parameters:
contextPath- List of java package names that contain schema derived classes. Classes inclassesToBeBoundthat are in named modules must be in a package that isopento at least thejakarta.xml.bindmodule.classLoader- This class loader will be used to locate the implementation classes.properties- provider-specific properties. Can be null, which means the same thing as passing in an empty map.- Returns:
- a new instance of a
JAXBContext - Throws:
JAXBException- if an error was encountered while creating theJAXBContextsuch as- failure to locate either ObjectFactory.class or jaxb.index in the packages
- an ambiguity among global elements contained in the contextPath
- failure to locate a value for the context factory provider property
- mixing schema derived packages from different providers on the same contextPath
- packages are not open to
jakarta.xml.bindmodule
- Since:
- 9, JAXB 2.3
-
-