0

We want to choose a manner to use for parsing and writing XML. We try the generation with JAXB maven plugin.

The generated POJOs classes are not so well constructed compare of manual writing, but we can preserve a lot of time if we use them. (The problem is that our xsd is not very well constructed, but we ca not change it).

I would like to ask what is better to use.

I read this page discussing about props/cons of manual vs generated POJO, but the discution is not in point of performance view. Do you know, are there disadvantages from performance point of view to use generated POJOs ?

Our way of using the generated classes need that after the generation the classes are converted to other POJO types. I specify that the XMLs that we manipulate are small in size.

Sofia
  • 57
  • 9
  • What do you mean with "POJOs classes are not so well constructed compare of manual writing"? If you can eliminate manual work by auto-generating code, it's usually a good idea. – Mick Mnemonic Feb 22 '19 at 15:29
  • Thank you @MickMnemonic. I mean that the structure of the classes, the attributes names are no so lisible because there are comming from our xsd model, which is construct as is it and we can not change it. I know that with the bindings we can change the name of the classes. But this is not the real problem. We can use the generated code, but we are not sure is this is in the best practice and if in term of performance it is a good idea. – Sofia Feb 22 '19 at 15:37
  • I would say that if you have an XSD (schema definition), and you need to create an object model from the schema, the best way to do that is to autogenerate the model (e.g. through JAXB). Performance shouldn't usually be a problem, unless you have specific concerns or demands? – Mick Mnemonic Feb 22 '19 at 15:44
  • Thank you for you opinion. Have you already used it in production ? – Sofia Feb 22 '19 at 16:07
  • Yes, I have used JAXB quite a bit in many projects. – Mick Mnemonic Feb 22 '19 at 16:09
  • Thank for this answer. – Sofia Feb 22 '19 at 16:24

0 Answers0