17
17
* because it can provide default implementation for any methods that may
18
18
* be added in {@link PropertyFilter} (as unfortunate as additions may be).
19
19
*/
20
- public abstract class SimpleBeanPropertyFilter
20
+ public class SimpleBeanPropertyFilter
21
21
implements BeanPropertyFilter , PropertyFilter
22
22
// sub-classes must also implement java.io.Serializable
23
23
{
@@ -29,6 +29,17 @@ public abstract class SimpleBeanPropertyFilter
29
29
30
30
protected SimpleBeanPropertyFilter () { }
31
31
32
+ /**
33
+ * Convenience factory method that will return a "no-op" filter that will
34
+ * simply just serialize all properties that are given, and filter out
35
+ * nothing.
36
+ *
37
+ * @since 2.5
38
+ */
39
+ public static SimpleBeanPropertyFilter serializeAll (Set <String > properties ) {
40
+ return new FilterExceptFilter (properties );
41
+ }
42
+
32
43
/**
33
44
* Factory method to construct filter that filters out all properties <b>except</b>
34
45
* ones includes in set
@@ -105,15 +116,23 @@ public void serializeAsElement(Object elementValue,
105
116
* Method called to determine whether property will be included
106
117
* (if 'true' returned) or filtered out (if 'false' returned)
107
118
*/
108
- protected abstract boolean include (BeanPropertyWriter writer );
119
+ protected boolean include (BeanPropertyWriter writer ) {
120
+ return true ;
121
+ }
109
122
110
123
/**
124
+ * Method called to determine whether property will be included
125
+ * (if 'true' returned) or filtered out (if 'false' returned)
126
+ *
111
127
* @since 2.3
112
128
*/
113
- protected abstract boolean include (PropertyWriter writer );
129
+ protected boolean include (PropertyWriter writer ) {
130
+ return true ;
131
+ }
114
132
115
133
/**
116
- * Method that defines what to do with container elements;
134
+ * Method that defines what to do with container elements
135
+ * (values contained in an array or {@link java.util.Collection}:
117
136
* default implementation simply writes them out.
118
137
*
119
138
* @since 2.3
0 commit comments