开发者

when jackson auto detect setter, can I force it to use the pascal case?

Currently when jackson object mapper auto detetc setter, it defaults to lower case. Can I change the mapping to 开发者_Python百科Pascal case?


It is possible to create custom AnnotationIntrospector that can find setters/getters that use different naming convention. But there is no automatic way to define mapping between external (in JSON) names to bean properties, using other name-mangling schemes. At least not yet; adding support is planned for 1.8.

Until then, one needs to use @JsonProperty annotation, or override internal classes (aside from AnnotationIntrospector there are other extension points that would work, but that's more of discussion for mailing lists).


I'm not sure what "Pascal case" is but the answer is no. All Java object mappers have to comply to the Java Beans API which clearly defines the case for fields, setters and getters and how one name can be derived from another.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜