You can try this out now using a download available from:
August 19, 2011
Binding to JSON & XML - Geocode Example
In a previous post I introduced the JSON binding that was added in the MOXy component in EclipseLink 2.4. In that post I explained how the same metadata that is used for XML binding can be directly applied to JSON binding. In this post I will demonstrate how powerful this is, by mapping one object model to both XML and JSON using the same set of metadata. Google Maps Geocoding API V2 will be used to provide the XML and JSON inputs for this example.
Labels:
EclipseLink,
EclipseLink 2.4,
Extension,
Geocode,
JAXB,
JSON,
MOXy,
XmlPath
August 16, 2011
Using an Unmarshaller.Listener to Capture the Location
Recently I came across a question on Stack Overflow asking how find where in the document an object was unmarshalled from. In this post I'll expand on my answer of using an XMLStreamReader and Unmarshaller.Listener to accomplish this.
August 15, 2011
JSON Binding with EclipseLink MOXy - Twitter Example
In a previous post I described how the Jettison library could be used with any JAXB implementation (Metro, MOXy, JaxMe, etc) to produce/consume JSON. Now I'll demonstrate the native object-to-JSON binding MOXy JAXB introduced in EclipseLink 2.4. With MOXy as your JAXB provider you can produce/consume JSON using the standard JAXB APIs (available in Java SE 6) without adding any compile time dependencies.
You can try this out now using a download available from:
You can try this out now using a download available from:
Labels:
EclipseLink,
EclipseLink 2.4,
Extension,
JSON,
MOXy,
Twitter,
XmlAdapter
July 29, 2011
JAXB (XJC) and Nested Classes
Recently I came across a complaint on Twitter about how JAXB (XJC) generates deeply nested class structures from XML schemas. In this post I want to first explain why JAXB does this, and second how to easily configure JAXB not to do this.
June 30, 2011
JAXB and Complex Types with Simple Content
A common question that appears on the forums is something like: "How do I map an object to an XML element with attributes and text in JAXB?". The answer is to use JAXB's @XmlValue annotation. In this post I'll demonstrate how this annotation can be leveraged.
Related Stack Overflow Questions:
Related Stack Overflow Questions:
- How can I add an attribute to a text element in JAXB?
- How to parse <foo value1=“a” value2=“b”>value3</foo> with JAXB?
- XML element with attribute and content using JAXB
June 27, 2011
JAXB and Factory Methods
Everyone knows that by default JAXB uses the no-argument constructor when instantiating objects. Readers of this blog are also familiar with using XmlAdapters to build objects. In this post I'll cover how the use of factory classes and methods can be configured through the @XmlType annotation.
June 24, 2011
Using JAXB's @XmlAccessorType to Configure Field or Property Access
JAXB offers a lot of flexibility when interacting with your object model. One area is configuring the use of fields or properties to access the data in your domain objects. This is specified as an XmlAccessType (PUBLIC_MEMBER, PROPERTY, FIELD, or NONE) via the @XmlAccessorType annotation. In this post we'll examine what these options really mean.
June 22, 2011
EclipseLink 2.3 Release Available for Download
On behalf of the MOXy JAXB committers (great job by all), I am very proud to announce that EclipseLink 2.3 has been released and is available for download. In this post I will summarize what is new in the MOXy component:
June 21, 2011
MOXy Extensible Models - Multiple Versions
Recently I have discussed support for extensible models in EclipseLink JAXB (MOXy) 2.3. The metadata for the extensions is supplied via MOXy's mapping document. In this post I will demonstrate how to leverage MOXy's support for multiple mapping documents to keep your metadata organized.
Labels:
EclipseLink,
EclipseLink 2.3,
Extension,
JAXB,
Mapping File,
MOXy,
XmlVirtualAccessMethods
June 14, 2011
MOXy Extensible Models - Refresh Example
In this example we will leverage EclipseLink JAXB (MOXy)'s concepts of externalized metadata (represented as a MetadataSource), and extensible models. The MetadataSource will be used to define the metadata for the extensions. In EclipseLink 2.3 we have introduced the ability for a JAXBContext to be "refreshed". This means that without stopping the application we can supply metadata about new extensions.
Labels:
EclipseLink,
EclipseLink 2.3,
Extension,
JAXB,
MetadataSource,
MOXy,
XmlVirtualAccessMethods
Subscribe to:
Posts (Atom)