Skip to content

Example demonstrating how EclipseLink JAXB (MOXy)'s metadata can be represented as JSON.

Notifications You must be signed in to change notification settings

bdoughan/blog20120418

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Extending JAXB - Representing Metadata as JSON

This is the complete source code for the following blog post:

Summary

In EclipseLink 2.4 the MOXY component includes support for representing the mapping metadata as JSON. Now you can have a binding file like:

{
   "package-name" : "blog.bindingfile",
   "xml-schema" : {
      "element-form-default" : "QUALIFIED",
      "namespace" : "http://www.example.com/customer"
   },
   "java-types" : {
      "java-type" : [ {
         "name" : "Customer",
         "xml-type" : {
            "prop-order" : "firstName lastName address phoneNumbers"
         },
         "xml-root-element" : {},
         "java-attributes" : {
            "xml-element" : [ 
                {"java-attribute" : "firstName","name" : "first-name"}, 
                {"java-attribute" : "lastName", "name" : "last-name"}, 
                {"java-attribute" : "phoneNumbers","name" : "phone-number"}
            ]
         }
      }, {
         "name" : "PhoneNumber",
         "java-attributes" : {
            "xml-attribute" : [ 
                {"java-attribute" : "type"}
            ],
            "xml-value" : [ 
                {"java-attribute" : "number"}
            ]
         }
      } ]
   }
}

Compile the Example

You can compile the example code using the following command. Maven will automatically fetch the required dependencies.

 mvn compile

Run the Example

You can run the example using the following command.

mvn exec:java

About

Example demonstrating how EclipseLink JAXB (MOXy)'s metadata can be represented as JSON.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages