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 "EclipseLink/Development/2.1/DynamicMOXy/296967/BootstrapFromOXM/ObjectFactory"
< EclipseLink | Development | 2.1 | DynamicMOXy/296967 | BootstrapFromOXM
(→Background) |
(→Background) |
||
Line 12: | Line 12: | ||
A public class <tt>ObjectFactory</tt> contains: | A public class <tt>ObjectFactory</tt> contains: | ||
• An instance factory method signature for each Java content within the | • An instance factory method signature for each Java content within the | ||
− | package. | + | package.<br> |
Given Java value class named Foo, here is the derived factory method:<br><br> | Given Java value class named Foo, here is the derived factory method:<br><br> | ||
Line 19: | Line 19: | ||
• An element instance factory method signature for each bound element | • An element instance factory method signature for each bound element | ||
− | declaration. | + | declaration.<br> |
<tt>public JAXBElement<T> createFoo(T elementValue);</tt> | <tt>public JAXBElement<T> createFoo(T elementValue);</tt> | ||
− | • Dynamic instance factory allocator method signature: | + | • Dynamic instance factory allocator method signature:<br> |
<tt>public Object newInstance(Class javaContentInterface);</tt> | <tt>public Object newInstance(Class javaContentInterface);</tt> | ||
• Property setter/getter - Provide the ability to associate implementation specific property/value | • Property setter/getter - Provide the ability to associate implementation specific property/value | ||
− | pairs with the instance creation process. | + | pairs with the instance creation process.<br> |
<tt>java.lang.Object getProperty(String name); | <tt>java.lang.Object getProperty(String name); |
Revision as of 14:27, 2 September 2010
Supporting ObjectFactory in Dynamic JAXB
Background
In standard JAXB, when classes are generated from a schema, an ObjectFactory class is also created, with methods to create new instances of all types in the schema, etc. From the JAXB 2.2 spec: