| Summary: | Memory Improvement - Allow a JAXBContext to extend an existing JAXBContext | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Blaise Doughan <blaise.doughan> | ||||||||
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||||||
| Status: | NEW --- | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | ||||||||||
| Version: | unspecified | ||||||||||
| Target Milestone: | --- | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows XP | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Blaise Doughan
Created attachment 191937 [details]
MOXy - Fix
This would allow a user to do something like:
package memory;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.eclipse.persistence.jaxb.JAXBContextFactory;
import org.eclipse.persistence.jaxb.JAXBHelper;
public class Demo {
public static void main(String[] args) throws Exception {
JAXBContext addressJC = JAXBContext.newInstance(Address.class);
Map<String, Object> customerJCProperties = new HashMap<String, Object>();
customerJCProperties.put(JAXBContextFactory.PARENT_CONTEXT_KEY, addressJC);
JAXBContext customerJC = JAXBContext.newInstance(new Class[] {Customer.class}, customerJCProperties);
Map<String, Object> purchaseOrderJCProperties = new HashMap<String, Object>();
purchaseOrderJCProperties.put(JAXBContextFactory.PARENT_CONTEXT_KEY, customerJC);
JAXBContext purchaseOrderJC = JAXBContext.newInstance(new Class[] {PurchaseOrder.class}, purchaseOrderJCProperties);
PurchaseOrder po = new PurchaseOrder();
Address shippingAddress = new Address();
shippingAddress.setStreet("456 B Road");
po.setShippingAddress(shippingAddress);
Customer customer = new Customer();
Address billingAddress = new Address();
billingAddress.setStreet("123 A Street");
customer.setBillingAddress(billingAddress);
po.setCustomer(customer);
Marshaller poMarshaller = purchaseOrderJC.createMarshaller();
poMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
poMarshaller.marshal(po, System.out);
System.out.println(JAXBHelper.getJAXBContext(addressJC).getXMLDescriptor(Address.class) == JAXBHelper.getJAXBContext(purchaseOrderJC).getXMLDescriptor(Address.class));
}
}
Created attachment 192018 [details]
MOXy - Fix
Created attachment 192039 [details]
MOXy - Fix
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |