PropertyFilter implementation that only uses property name
to determine whether to serialize property as is, or to filter it out.
Use of this class as the base implementation for any custom
PropertyFilter implementations is strongly encouraged,
because it can provide default implementation for any methods that may
be added in PropertyFilter (as unfortunate as additions may be).
| Modifier and Type | Class and Description |
|---|---|
| public static class | SimpleBeanPropertyFilter.
Filter implementation which defaults to filtering out unknown properties and only serializes ones explicitly listed. |
| public static class | SimpleBeanPropertyFilter.
Filter implementation which defaults to serializing all properties, except for ones explicitly listed to be filtered out. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public void | depositSchemaProperty(PropertyWriter writer, JsonObjectFormatVisitor objectVisitor, SerializationContext provider)
Implements tools. Method called by |
| public static SimpleBeanPropertyFilter | filterOutAll()
Convenience factory method that will return a filter that will simply filter out everything. |
| public static SimpleBeanPropertyFilter | filterOutAllExcept(Set<String> properties)
Factory method to construct filter that filters out all properties except ones includes in set |
| public static SimpleBeanPropertyFilter | |
| protected boolean | include(BeanPropertyWriter writer)
Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned) |
| protected boolean | include(PropertyWriter writer)
Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned) |
| protected boolean | includeElement(Object elementValue)
Method that defines what to do with container elements
(values contained in an array or |
| public static SimpleBeanPropertyFilter | serializeAll()
Convenience factory method that will return a "no-op" filter that will simply just serialize all properties that are given, and filter out nothing. |
| public static SimpleBeanPropertyFilter | |
| public static SimpleBeanPropertyFilter | |
| public void | serializeAsElement(Object elementValue, JsonGenerator g, SerializationContext provider, PropertyWriter writer)
Implements tools. Method called by container to let the filter decide what to do with given element
value:
the usual choices are to either filter out (i.e.
do nothing) or write using given |
| public void | serializeAsProperty(Object pojo, JsonGenerator g, SerializationContext provider, PropertyWriter writer)
Implements tools. Method called by |
| public PropertyFilter | snapshot()
Implements tools. Method to call to get an instance that may not be modified through any other object, including `this`. |
| SimpleBeanPropertyFilter | back to summary |
|---|---|
| protected SimpleBeanPropertyFilter() | |
| depositSchemaProperty | back to summary |
|---|---|
| public void depositSchemaProperty(PropertyWriter writer, JsonObjectFormatVisitor objectVisitor, SerializationContext provider) Implements tools. Doc from tools. Method called by Typical implementation is something like:
if (include(writer)) {
writer.depositSchemaProperty(objectVisitor, provider);
}
| |
| filterOutAll | back to summary |
|---|---|
| public static SimpleBeanPropertyFilter filterOutAll() Convenience factory method that will return a filter that will simply filter out everything. | |
| filterOutAllExcept | back to summary |
|---|---|
| public static SimpleBeanPropertyFilter filterOutAllExcept(Set<String> properties) Factory method to construct filter that filters out all properties except ones includes in set | |
| filterOutAllExcept | back to summary |
|---|---|
| public static SimpleBeanPropertyFilter filterOutAllExcept(String... propertyArray) | |
| include | back to summary |
|---|---|
| protected boolean include(BeanPropertyWriter writer) Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned) | |
| include | back to summary |
|---|---|
| protected boolean include(PropertyWriter writer) Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned) | |
| includeElement | back to summary |
|---|---|
| protected boolean includeElement(Object elementValue) Method that defines what to do with container elements
(values contained in an array or | |
| serializeAll | back to summary |
|---|---|
| public static SimpleBeanPropertyFilter serializeAll() Convenience factory method that will return a "no-op" filter that will simply just serialize all properties that are given, and filter out nothing. | |
| serializeAllExcept | back to summary |
|---|---|
| public static SimpleBeanPropertyFilter serializeAllExcept(Set<String> properties) | |
| serializeAllExcept | back to summary |
|---|---|
| public static SimpleBeanPropertyFilter serializeAllExcept(String... propertyArray) | |
| serializeAsElement | back to summary |
|---|---|
| public void serializeAsElement(Object elementValue, JsonGenerator g, SerializationContext provider, PropertyWriter writer) throws Exception Implements tools. Doc from tools. Method called by container to let the filter decide what to do with given element
value:
the usual choices are to either filter out (i.e.
do nothing) or write using given Typical implementation is something like:
if (include(writer)) {
writer.serializeAsElement(pojo, gen, prov);
}
| |
| serializeAsProperty | back to summary |
|---|---|
| public void serializeAsProperty(Object pojo, JsonGenerator g, SerializationContext provider, PropertyWriter writer) throws Exception Implements tools. Doc from tools. Method called by Typical implementation is something like:
if (include(writer)) {
writer.serializeAsProperty(pojo, gen, prov);
}
| |
| snapshot | back to summary |
|---|---|
| public PropertyFilter snapshot() Implements tools. Doc from tools. Method to call to get an instance that may not be modified through any other object, including `this`. That instance may be `this` if (and only if) this instance is effectively immutable (unmodifiable) through its API: if this is not the case, a new copy with same configuration must be created and returned.
| |
| Modifier and Type | Field and Description |
|---|---|
| protected final Set | _propertiesToInclude
Set of property names to serialize. |
| pack-priv static final SimpleBeanPropertyFilter. | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | include(BeanPropertyWriter writer)
Overrides tools. Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned) |
| protected boolean | include(PropertyWriter writer)
Overrides tools. Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned) |
| _propertiesToInclude | back to summary |
|---|---|
| protected final Set<String> _propertiesToInclude Set of property names to serialize. | |
| EXCLUDE_ALL | back to summary |
|---|---|
| pack-priv static final SimpleBeanPropertyFilter. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| FilterExceptFilter | back to summary |
|---|---|
| public FilterExceptFilter(Set<String> properties) | |
| include | back to summary |
|---|---|
| protected boolean include(BeanPropertyWriter writer) Overrides tools. Doc from tools. Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)
| |
| include | back to summary |
|---|---|
| protected boolean include(PropertyWriter writer) Overrides tools. Doc from tools. Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)
| |
| Modifier and Type | Field and Description |
|---|---|
| protected final Set | _propertiesToExclude
Set of property names to filter out. |
| pack-priv static final SimpleBeanPropertyFilter. | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | include(BeanPropertyWriter writer)
Overrides tools. Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned) |
| protected boolean | include(PropertyWriter writer)
Overrides tools. Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned) |
| _propertiesToExclude | back to summary |
|---|---|
| protected final Set<String> _propertiesToExclude Set of property names to filter out. | |
| INCLUDE_ALL | back to summary |
|---|---|
| pack-priv static final SimpleBeanPropertyFilter. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| SerializeExceptFilter | back to summary |
|---|---|
| public SerializeExceptFilter(Set<String> properties) | |
| include | back to summary |
|---|---|
| protected boolean include(BeanPropertyWriter writer) Overrides tools. Doc from tools. Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)
| |
| include | back to summary |
|---|---|
| protected boolean include(PropertyWriter writer) Overrides tools. Doc from tools. Method called to determine whether property will be included (if 'true' returned) or filtered out (if 'false' returned)
| |