spring boot - Lombok Getter&Setter not work in bean having custom deserializer -


the issue use lombok annotations @getter , @setter§ beans use parse json files. issue noticed attribute custom deserializer, jackson, not using custom deserializer , error :

for boolean field, true or false recognized 

while i'm receiving no false, , yes true.

@jsonproperty(value = "comment") @jsondeserialize(using = noyesdeserializer.class) private boolean comment; 

i put annotation on class level : @data , @noargsconstructor

public class noyesdeserializer extends jsondeserializer<boolean> {  @override public boolean deserialize(jsonparser p, deserializationcontext ctxt) throws ioexception {         if (stringutils.isnotblank(p.gettext())) {             string text = p.gettext();             if (text.tolowercase().indexof("yes") >= 0) {                 return boolean.true;             } else if (text.tolowercase().indexof("no") >= 0) {                 return boolean.false;             }         }          throw new ioexception("unrecognized boolean value " + p.gettext());     } } 


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -