cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dhiraj Bokde (JIRA)" <>
Subject [jira] [Commented] (CXF-6287) JAX-RS client should use Enum.value() instead of toString()
Date Wed, 11 Mar 2015 18:31:38 GMT


Dhiraj Bokde commented on CXF-6287:

I've added this comment to the way CXF handles JAXB enums on the server side, copying the
comment here. 

IMHO, CXF support for fromValue() for JAXB enums essentially renders it's enum handling asymmetrical
(inconsistent from a user's point of view) for clients and servers.
The options for CXF are:
1. If CXF wants to support fromValue() on server side, it should also support value() on the
client side, otherwise it can't produce what it can consume. 
2. Drop support for fromValue() on server side, provide a JAXB enum ParamConverterProvider
that users can configure on the client and server side.
Either way, CXF should treat JAXB enums as a producer and consumer consistently.

> JAX-RS client should use Enum.value() instead of toString()
> -----------------------------------------------------------
>                 Key: CXF-6287
>                 URL:
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 3.0.4
>            Reporter: Dhiraj Bokde
>            Assignee: Sergey Beryozkin
>            Priority: Minor
>             Fix For: NeedMoreInfo
> A JAX-RS endpoints that uses an JAXB enumeration as a parameter marshals it using {{toString()}}
instead of its {{public String value()} method. 
> This results in invalid values being marshaled for values, such as {{STATUS_UPDATE}}
instead of {{status-update}}. 
> This requires writing a custom enumeration ParamConverterProvider. Since all JAXB enumerations
follow standard method patterns for marshaling {{public String value()}} and unmarshaling
{{public static T fromValue(String value)}}, they should be handled by CXF by default. 

This message was sent by Atlassian JIRA

View raw message