users@jersey.java.net

Re: [Jersey] How can I make Inflecter to capitalize initial

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 29 Jun 2009 09:13:06 +0200

On Jun 26, 2009, at 6:00 PM, Jakub Podlesak wrote:

> On Fri, Jun 26, 2009 at 02:12:51PM +0200, Paul Sandoz wrote:
>>
>> On Jun 26, 2009, at 2:05 PM, testn wrote:
>>
>>>
>>> Basically, I'm trying to make Class to be capitalized... i.e.
>>> Currency,
>>> Person etc. And then when I represent List<T>, I would like to make
>>> Inflecter to capitalize them as well
>>>
>>> so instead of
>>>
>>> <currencies>
>>> <Currency>
>>> <currencyCode>USD</currencyCode>
>>> <currencyDescription>US Dollar</currencyDescription>
>>> </Currency>
>>> </currencies>
>>>
>>> I'd like to have
>>> <Currencies>
>>> <Currency>
>>> <currencyCode>USD</currencyCode>
>>> <currencyDescription>US Dollar</currencyDescription>
>>> </Currency>
>>> </Currencies>
>>>
>>> Is there a way to configure it?
>>>
>>
>> No, the current JAXB code does the following:
>>
>> protected final String getRootElementName(Class<?> elementType) {
>> return
>> convertToXmlName
>> (inflector
>> .decapitalize
>> (inflector.pluralize(inflector.demodulize(elementType.getName()))));
>> }
>>
>> It decapitalizes for canonicalization purposes when pluralizing.
>>
>> But i think it should preserve at least the case of the first letter
>> of the original name.
>>
>> Could you log an issue?
>
> I might be wrong, but the generated names are also used when
> generating input for JAXB, and then the required change could break
> things,
> if the same change does not happen in JAXB.
>

Not in JAXB, but in the *application code*". You made me realize that
we cannot change the current behavior because it will break consumers
of the XML. We would require some optional config option.

Paul.


> Need to double-check.
>
> ~Jakub
>
>
>
>>
>> Thanks,
>> Paul.
>>
>>> Thanks!!!!
>>>
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/How-can-I-make-Inflecter-to-capitalize-initial-tp3161130p3161130.html
>>> Sent from the Jersey mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>