我的哈希映射Map<String, String>
具有以下值,请注意点表示层次结构:
+--------------------+-----------+
| Key | Value |
+--------------------+-----------+
| car.color | blue |
| car.engine.make | mitsubishi|
| car.engine.power | 120 |
+--------------------+-----------+
我有pojo课程:
public class Vehicle {
private Car car;
**Setters and Getters Below*
}
public class Car {
private String color;
private Engine engine;
**Setters and Getters Below*
}
public class Engine {
private String make;
private Integer power;
**Setters and Getters Below**
}
有什么方法可以根据层次结构将HashMap映射到POJO类?我试图使用jackson ObjectMapper mapper = new ObjectMapper();
但它似乎能够映射1级对象。