Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/UserGuide/MOXy/Runtime/Bootstrapping"

Line 5: Line 5:
 
|toc=y
 
|toc=y
 
|api=y
 
|api=y
|apis= * [http://www.eclipse.org/eclipselink/api/latest/javax/xml/bind/JAXBContext.html JAXBContext]
+
|apis= * [http://www.eclipse.org/eclipselink/api/latest/javax/xml/bind/annotation/XmlRootElement.html XmlRootElement]
 
}}
 
}}
  
 
= Bootstrapping =
 
= Bootstrapping =
 +
 +
EclipseLink MOXy offers several options when creating your '''JAXBContext'''.  You have the option of bootstrapping from:
 +
 +
* A list of one or more JAXB-annotated ''Classes''
 +
* A list of one or more EclipseLink OXM Bindings Files defining the mappings for your Java classes
 +
* A combination of '''Classes''' and OXM files
 +
* A '''Session''' name, referring to an EclipseLink '''Session''' defined in '''sessions.xml'''
 +
 +
== Instantiating a JAXBContext ==
 +
 +
The following methods on '''JAXBContext''' can be used to create new instances of '''JAXBContexts''':
 +
 +
<source lang="java">
 +
public static JAXBContext newInstance(Class... classesToBeBound) throws JAXBException
 +
 +
public static JAXBContext newInstance(Class[] classesToBeBound, Map<String,?> properties) throws JAXBException
 +
 +
public static JAXBContext newInstance(String contextPath) throws JAXBException
 +
 +
public static JAXBContext newInstance(String contextPath, ClassLoader classLoader) throws JAXBException
 +
 +
public static JAXBContext newInstance(String contextPath, ClassLoader classLoader, Map<String,?> properties) throws JAXBException
 +
</source>
 +
 +
* '''classesToBeBound''' - List of Java classes to be recognized by the new '''JAXBContext'''.
 +
* '''contextPath''' - List of Java package names that contain mapped classes.
 +
* '''classLoader''' - The class loader used to locate the mapped classes.
 +
* '''properties''' - A map of additional properties.

Revision as of 10:46, 10 June 2011

EclipseLink MOXy

Eclipselink-logo.gif
EclipseLink
Website
Download
Community
Mailing ListForumsIRCmattermost
Issues
OpenHelp WantedBug Day
Contribute
Browse Source

Elug api package icon.png Key API

Bootstrapping

EclipseLink MOXy offers several options when creating your JAXBContext. You have the option of bootstrapping from:

  • A list of one or more JAXB-annotated Classes
  • A list of one or more EclipseLink OXM Bindings Files defining the mappings for your Java classes
  • A combination of Classes and OXM files
  • A Session name, referring to an EclipseLink Session defined in sessions.xml

Instantiating a JAXBContext

The following methods on JAXBContext can be used to create new instances of JAXBContexts:

public static JAXBContext newInstance(Class... classesToBeBound) throws JAXBException
 
public static JAXBContext newInstance(Class[] classesToBeBound, Map<String,?> properties) throws JAXBException
 
public static JAXBContext newInstance(String contextPath) throws JAXBException
 
public static JAXBContext newInstance(String contextPath, ClassLoader classLoader) throws JAXBException
 
public static JAXBContext newInstance(String contextPath, ClassLoader classLoader, Map<String,?> properties) throws JAXBException
  • classesToBeBound - List of Java classes to be recognized by the new JAXBContext.
  • contextPath - List of Java package names that contain mapped classes.
  • classLoader - The class loader used to locate the mapped classes.
  • properties - A map of additional properties.

Back to the top