java - Jackson mapper to persistence object -


i writing junit complex hierarchy application need test service input large , complicated persistence object. big decided initialize jsonn string. problem because has large inheritance tree getting difficult jackson de serializing it. there why instruct jackson annotation not automatic serializing , explicit. want ignore filed , getters/setters except 1 @jsonproperty annotation

solved using following config

getmapper().setvisibilitychecker(getmapper().getdeserializationconfig().getdefaultvisibilitychecker()             .withcreatorvisibility(jsonautodetect.visibility.none)             .withfieldvisibility(jsonautodetect.visibility.none)             .withgettervisibility(jsonautodetect.visibility.none)             .withisgettervisibility(jsonautodetect.visibility.none)             .withsettervisibility(jsonautodetect.visibility.none)); 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -