After constructing JavaType
, both call same deserialization functionality, so the only difference is the way generic type is handled.
Second one is fully static, so type must be known in compile type, and can not vary. So it is similar to using basic Class literal.
First one is dynamic, so it can be used to construct things that vary regarding their parameterization.
Personally I prefer first alternative for all cases (it avoids creation of one more anonymous inner classes), but second one may be more readable.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…