Strangely I couldn't find an existing question on this. I'm simply looking for a way (hopefully a one-liner) to do a programmatic conversion from e.g. <sales_order_number> to salesOrderNumber, and back again.
In Jackson terms, I'm looking for the JAXB equivalent of:
mapper.setPropertyNamingStrategy(new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy())
Any help gratefully received!
Note: I'm the EclipseLink JAXB (MOXy) lead and a member of the JAXB (JSR-222) expert group.
Using the standard JAXB APIs you will need to use the JAXB annotations on individual properties to override the default name.
@XmlElement(name="sales_order_number")
private String salesOrderNumber;
MOXy provides am extension mechanism (XMLNameTransformer) where you can override the default name algorithm:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With