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

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -