osglworks / java-tool

Some simple common Java utilities
Apache License 2.0
52 stars 18 forks source link

Data mapper - support mapping between map and pojo #228

Open greenlaw110 opened 4 years ago

greenlaw110 commented 4 years ago

For the following given POJO class:

    public static class Bar {
        public int id;
    }

    public static class Foo {
        public String name;
        public Bar bar;
    }

Suppose an instance of Foo has the following data:

{
    "name": "abc",
    "bar": {
        "id": 123
    }
}

Then it shall be able to map to Map<String, Object> as:

"name": "abc",
"bar.id":  123

The reverse mapping shall also apply