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.
Difference between revisions of "User:Rick.barkhouse.oracle.com/Test2"
Line 19: | Line 19: | ||
To implement your own '''MetadataSource''', you can: | To implement your own '''MetadataSource''', you can: | ||
− | * Create a new class that implements the '''org.eclipse.persistence.jaxb.metadata.MetadataSource''' interface | + | * Create a new class that implements the '''org.eclipse.persistence.jaxb.metadata.MetadataSource''' interface. |
− | * Create a new class that extends the '''org.eclipse.persistence.jaxb.metadata.MetadataSourceAdapter''' class | + | * Create a new class that extends the '''org.eclipse.persistence.jaxb.metadata.MetadataSourceAdapter''' class. Using this method is preferred, as it will insulate you from future additions to the interface. |
− | + | ||
+ | In either case, you will be responsible for implementing the following method: | ||
+ | |||
+ | <div style="width:700px"> | ||
+ | <source lang="java"> | ||
+ | /** | ||
+ | * Retrieve XmlBindings according to the JAXBContext bootstrapping information. | ||
+ | * | ||
+ | * @param properties - The properties passed in to create the JAXBContext | ||
+ | * @param classLoader - The ClassLoader passed in to create the JAXBContext | ||
+ | * @return the XmlBindings object representing the metadata | ||
+ | */ | ||
+ | XmlBindings getXmlBindings(Map<String, ?> properties, ClassLoader classLoader); | ||
+ | </source> | ||
+ | </div> |
Revision as of 16:14, 6 July 2011
EclipseLink MOXy
EclipseLink | |
Website | |
Download | |
Community | |
Mailing List • Forums • IRC • mattermost | |
Issues | |
Open • Help Wanted • Bug Day | |
Contribute | |
Browse Source |
XML MetadataSource
EclipseLink 2.3 introduces the concept of a MetadataSource, which is responsible for serving up EclipseLink metadata. This allows you to store mapping information outside of your application and have it retrieved when the application's JAXBContext is being created or refreshed.
Implementing a MetadataSource
To implement your own MetadataSource, you can:
- Create a new class that implements the org.eclipse.persistence.jaxb.metadata.MetadataSource interface.
- Create a new class that extends the org.eclipse.persistence.jaxb.metadata.MetadataSourceAdapter class. Using this method is preferred, as it will insulate you from future additions to the interface.
In either case, you will be responsible for implementing the following method:
/** * Retrieve XmlBindings according to the JAXBContext bootstrapping information. * * @param properties - The properties passed in to create the JAXBContext * @param classLoader - The ClassLoader passed in to create the JAXBContext * @return the XmlBindings object representing the metadata */ XmlBindings getXmlBindings(Map<String, ?> properties, ClassLoader classLoader);