annotation-introspector

How to conditionally ignore properties with a Jackson AnnotationIntrospector

此生再无相见时 提交于 2019-12-20 02:46:14
问题 I want to create an annotation to make Jackson ignore the annotated fields unless a certain tracing level is set: public class A { @IgnoreLevel("Debug") String str1; @IgnoreLevel("Info") String str2; } Or, if this is easier to implement, I could also have separate annotations for the different levels: public class A { @Debug String str1; @Info String str2; } Depending on the configuration of the ObjectMapper , either all "Debug" and "Info" fields shall be ignored when serializing and