users@jaxb.java.net

Re: Localisation and Customizing in JAXB

From: Steffen Bleul <StBleul_at_gmx.de>
Date: Mon, 03 May 2010 23:38:17 +0200

Hello,

I am marshalling Java objects, an XML schema is not available. The
objects are database entities and business objects. Therefore, I try to
avoid adjustmen of my java classes with additional fields or properties
because this is view specific code. A solution purely per configuration
would be great but currently im open to any suggestions.

Best regards,
Steffen Bleul


Am 03.05.2010 16:19, schrieb Wolfgang Laun:
> Are you generating Java classes from an XML schema (Is it possible to
> modify it?) or are you using hand coded Java classes?
> -W
>
> On Mon, May 3, 2010 at 3:26 PM, Steffen Bleul<stbleul_at_gmx.de> wrote:
>
>> Hello,
>>
>> I have a question regarding JAXB customizing with JaxbAdapters.
>>
>> I have a field in my object with type Double, in my case its necessary that this Double needs to be formatted/marshalled in 3 differents formats inside the same XML.
>>
>> public Double value = ...;
>>
>> Double: 0.1233554233
>> 1. Format, no commas: 0
>> 2. Format, 3 digits after comma: 0.123
>> 3. Format, 2 digits after comma: 0.12
>>
>> The resulting xml:
>> <doubleFormatA>0</doubleFormatA>
>> <doubleFormatB>0.123</doubleFormatB>
>> <doubleFormatC>0.12</doubleFormatC>
>>
>> Whats the best approach to do this in JAXB?
>>
>>