From bc59a9a7c63642c6f01a998cf361cd57d97fe1b2 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Sat, 30 Apr 2016 20:46:48 -0700 Subject: [PATCH] Add convenience accessors. --- .../annotation/JsonIgnoreProperties.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/java/com/fasterxml/jackson/annotation/JsonIgnoreProperties.java b/src/main/java/com/fasterxml/jackson/annotation/JsonIgnoreProperties.java index f30bdc08..af163dac 100644 --- a/src/main/java/com/fasterxml/jackson/annotation/JsonIgnoreProperties.java +++ b/src/main/java/com/fasterxml/jackson/annotation/JsonIgnoreProperties.java @@ -311,6 +311,34 @@ public Set getIgnored() { return _ignored; } + /** + * Method called to find names of properties to ignore when used for + * serialization: functionally + * same as {@link #getIgnored} if {@link #getAllowGetters()} is false + * (that is, there is "allowGetters=false" or equivalent), + * otherwise returns empty {@link java.util.Set}. + */ + public Set findIgnoredForSerialization() { + if (_allowGetters) { + return Collections.emptySet(); + } + return _ignored; + } + + /** + * Method called to find names of properties to ignore when used for + * serialization: functionally + * same as {@link #getIgnored} if {@link #getAllowSetters()} is false + * (that is, there is "allowSetters=false" or equivalent), + * otherwise returns empty {@link java.util.Set}. + */ + public Set findIgnoredForDeserialization() { + if (_allowSetters) { + return Collections.emptySet(); + } + return _ignored; + } + public boolean getIgnoreUnknown() { return _ignoreUnknown; }