Hey, there.
I'm facing a huge problem here at my environment, I need get at runtime my Object's name for example:
Class A {
private String bar;
}
A foo = new A();
At runtime I need exclude the field "bar" on my instance "foo" during the serialitazion without using @JsonIgnore on my class;
I'm trying the follow code by it doesn't work because I can't access the Object's name
mapper.setAnnotationIntrospector(new JacksonAnnotationIntrospector(){
@Override
protected boolean _isIgnorable(Annotated a) {
if(a.getName().contains("b")) {
return true;
}
boolean isIgnorable = super._isIgnorable(a);
return isIgnorable;
}
});
is there any way that I could do that?