Jackson is a Json series that is used extensively in Java system change and turn over alignment to convert kind of warehouse, it offerred rich API to be used to developer.
The record falls to use Jackson to handle the result of complex extensive object recently today, its core uses TypeFactory.constructParametricType() method namely, from inside Type constructs according to this outside arriving.
Example 1: List<Map<String, person>>
Assume I have an object List<Map<String, person>> , I construct first the object turns next for string.
Turn over its alignment to change next:
Change be meeting newspaper fault so directly!
The kind that needs to use TypeFactory.constructParametricType() to undertake JavaType is tectonic: LIst<Map<String, person>>
Those who need an attention is, need when construct from inside construction undertakes outside arriving:
- Construct first Map<String, person> gets InnerType
- Reframe List<innerType>
Code is shown as follows:
The proposal uses actual subclass model will replace: For instance Map is HashMap accurately, list is actual ArrayList accurately.Example 2: Map<String, list<Person>>
Here has place of a little knowledge, watchful is parameter type should match: COnstructParametricType method is like below 2 kinds of statement to need to notice:
The from the back alterable form in the method joins parameter to must agree.
Can examine return profit the reframe overall situation of 2, I am a hope originally:
But IDE clew parameter does not match, examining seriously is really: One is Class, one is JavaType.
Solve this problem through direct GetRawClass so:
Epilogue
Core train of thought: From inside the type constructs outside arriving, one step comes!
Achieve formerly not easy, acknowledgment attention, comment, transmit, collect!