Using Jackson, how can a list of known JSON properties be obtained for any arbitrary pojo class?

前端 未结 4 1292
暖寄归人
暖寄归人 2020-12-20 18:40

Ideally, it would look much like this:

List props = objectMapper.getKnownProperties(MyPojo.class);

Alas, there is no such met

4条回答
  •  别那么骄傲
    2020-12-20 19:10

    It's possible to ignore all annotations by using a dummy AnnotationIntrospector:

    objectMapper.setAnnotationIntrospector(new AnnotationIntrospector(){
        @Override public Version version() {
            return Version.unknownVersion();
        }
    });
    

提交回复
热议问题