JAXB is a 10-year-old Java technology that allows us to convert a Java object into an XML document (marshalling) and back (unmarshalling). This technology is based on setters and gettersand, in my opinion, violates key principles of object-oriented programming by turning objects into passive data structures. I would recommend you use Xembly instead for marshalling Java objects into XML documents.
- Posted by: Yegor Bugayenko
- Posted on: March 26 2015 23:04 EDT
over oracle supported jaxb ?
what a way to market yourself TSS has lost its audience , quality and everything else.
Coupling technical services, like XML generation, with business data just reduces flexibility. My business object is now stuck with your suspisious concept and if I want to switch to some other XML framework, I have to change the code.
You may continue your invention by adding toString(), toCSV(), toJSON() etc to your business class.
I use JAXB with Spring for my web services and I do not need setters and getters for my domain objects. Each domain object is immutable and uses an embedded builder pattern.
Moreover, I don't want any extra logic in my domain value objects beyond toString(), hashCode() and equals(). I only want to pass property values around.