Jump to: navigation, search

EclipseLink/Examples/MOXy/MOXy JSON Provider

< EclipseLink‎ | Examples‎ | MOXy
Revision as of 16:13, 15 June 2012 by Rick.barkhouse.oracle.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

MOXy JSON Provider

MOXy now includes an implementation (MOXyJsonProvider) that can be used directly or extended to make the integration even easier.

Using MOXyJsonProvider

Default Behaviour

You can use a JAX-RS Application class to specify that MOXyJsonProvider should be used with your JAX-RS application.

package org.example;
 
import java.util.*;
import javax.ws.rs.core.Application;
import org.eclipse.persistence.jaxb.rs.MOXyJsonProvider;
 
public class CustomerApplication  extends Application {
 
    @Override
    public Set<Class<?>> getClasses() {
        HashSet<Class<?>> set = new HashSet<Class<?>>(2);
        set.add(MOXyJsonProvider.class);
        set.add(CustomerService.class);
        return set;
    }
 
}