> -----Original Message-----
> From: David Hay [mailto:[email protected]]
> Sent: Monday, September 09, 2013 8:35 AM
> To: [email protected]
> Subject: Mapping POSTed JSON Enum parameter which implements an Interface
> 
> Hi,
> 
> I have a class with 2 enum properties - a concrete one (A), and one that
> implements an interface (B) and has multiple implementations, which are
> possible values for the selected value of A.  If A has the value 1, the B
> will be of type Enum1, which has the possible values for type 1.
> 
> When I POST to a REST endpoint to create this object, CXF has problems
> because of the Interface.
> 
> What's the best way to add something that will allow JSON posted to be
> mapped to the right enum type for the 2nd Enum?

I would certainly follow Sergey's suggestion, but I would point out a useful 
strategy for debugging problems like this.

CXF not only translates JSON to Java objects, it can go the other direction.  
If you don't understand why your JSON didn't translate properly to your Java 
object, then try implementing a service that goes in the other direction and 
look at what JSON it produces, and then compare that with the JSON you were 
using.  You'll find that you were either doing something wrong in your JSON, or 
you found a problem that needs to be dealt with.  In any case, you'll have 
narrowed down the problem.

Reply via email to