March 28, 2013

MOXy's Object Graphs - Partial Models on the Fly to/from XML & JSON

In a previous post I introduced how MOXy's Object Graph feature allows you to input and output partial models.  In that example I demonstrated how to define a partial model via metadata.  In this example we will create the object graphs programmatically.  This gives you additional flexibility when you need to create one on the fly.

You can try this out today by downloading an EclipseLink 2.5.0 nightly download starting on March 24, 2013 from:

March 26, 2013

MOXy's Object Graphs - Input/Output Partial Models to XML & JSON

Suppose you have a domain model that you want to expose as a RESTful service.  The problem is you only want to input/output part of your data.  Previously you would have created a separate model representing  the subset and then have code to move data between the models.  In EclipseLink 2.5.0 we have a new feature called Object Graphs that enables you to easily define partial views on your model.

You can try this out today by downloading an EclipseLink 2.5.0 nightly download starting on March 24, 2013 from:

March 15, 2013

Binding to JSON & XML - Handling Collections

One of EclipseLink JAXB (MOXy)'s strengths is the ability to map an object model to both JSON and XML with a single set of metadata.  The one weakness had been that you needed to compromise on the JSON key or XML element for collection properties.  I'm happy to say that this issue has been solved in EclipseLink 2.5 (and EclipseLink 2.4.2), and I will demonstrate below with an example.

You can try this out today by downloading an EclipseLink 2.5.0 (or EclipseLink 2.4.2) nightly build starting on March 15, 2013 from:

March 6, 2013

JAXB and java.util.Map

Is it ironic that it can be difficult to map the java.util.Map class in JAXB (JSR-222)?  In this post I will cover some items that will make it much easier.

March 3, 2013

MOXy's @XmlInverseReference is now Truly Bidirectional

EclipseLink JAXB (MOXy)'s @XmlInverseReference annotation enables you to map a back pointer during the unmarshal operation (useful when mapping JPA entities).  The problem was it acted like @XmlTransient during the marshal operation.  This means that previously it could only be used in one direction.  Now I'm happy to announce in EclipseLink 2.5.0 we have expanded @XmlInverseReference so that the corresponding property may be writeable enabling it to be used in both directions.

You can try this out today by downloading one EclipseLink 2.5.0 nightly downloads starting on March 1, 2013 from: