0

all.

I am a starter of camel. I have some problem. Here is a scenario.

The file has 2 fields in a body. (seq, date, charge no.) So, I generated pojo class for this dataformat.

    public class TestDataformat {
              int seq;
              Date date;
              String chargeNo;
    }

I made the application for camel. After some days, dataformat is changed about adding name field.

So, we need pojo class modified and application rebuild again. But we don’t want to build the application and generate pojo class for dataformat again.

If we can use xsd to make the Pojo class dynamically at runtime, can we handle it without additional build

Is possible about this assumption? or Is there any other way to do this?

Thank you.

이성규
  • 125
  • 11
  • Dont create pojo. Use a Map like HashMap. That will be the structure. Then you can add or take away any field. – Namphibian Sep 13 '19 at 01:22

1 Answers1

0

A simple solution to this kind of problem is to create a Map, for extra fields, that way you won't have to keep updating the POJO, these links might be useful HOW TO MAP UNKNOWN JSON PROPERTIES WITH JACKSON

Jackson deserialize extra fields as map

hope it helps.