T
- The bean type that this filter applies to.public class BeanFilterBuilder<T> extends Object
BeanFilter
objects.
This class is the programmatic equivalent to the @Bean
annotation.
The general approach to defining bean filters is to create subclasses from this class and call methods to set various attributes
Modifier | Constructor and Description |
---|---|
protected |
BeanFilterBuilder()
Constructor.
|
protected |
BeanFilterBuilder(Class<?> beanClass)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
BeanFilterBuilder<T> |
beanDictionary(Class<?>... values)
Configuration property: Bean dictionary.
|
BeanFilter |
build()
Creates a
BeanFilter with settings in this builder class. |
BeanFilterBuilder<T> |
excludeProperties(String... value)
Configuration property: Bean property excludes.
|
BeanFilterBuilder<T> |
fluentSetters()
Configuration property: Find fluent setters.
|
BeanFilterBuilder<T> |
fluentSetters(boolean value)
Configuration property: Find fluent setters.
|
BeanFilterBuilder<T> |
interfaceClass(Class<?> value)
Configuration property: Bean interface class.
|
BeanFilterBuilder<T> |
properties(String... value)
Configuration property: Bean property includes.
|
BeanFilterBuilder<T> |
propertyFilter(Class<? extends PropertyFilter> value)
Configuration property: Property filter.
|
BeanFilterBuilder<T> |
propertyNamer(Class<? extends PropertyNamer> value)
Configuration property: Bean property namer
|
BeanFilterBuilder<T> |
sortProperties()
Configuration property: Sort bean properties.
|
BeanFilterBuilder<T> |
sortProperties(boolean value)
Configuration property: Sort bean properties.
|
BeanFilterBuilder<T> |
stopClass(Class<?> value)
Configuration property: Bean stop class.
|
BeanFilterBuilder<T> |
typeName(String value)
Configuration property: Bean dictionary type name.
|
protected BeanFilterBuilder()
Bean class is determined through reflection of the parameter type.
protected BeanFilterBuilder(Class<?> beanClass)
beanClass
- The bean class that this filter applies to.public BeanFilterBuilder<T> typeName(String value)
Specifies the dictionary type name for this bean.
value
- The new value for this setting.public BeanFilterBuilder<T> properties(String... value)
Specifies the set and order of names of properties associated with the bean class.
value
- The new value for this setting.
public BeanFilterBuilder<T> excludeProperties(String... value)
Specifies properties to exclude from the bean class.
value
- The new value for this setting.
public BeanFilterBuilder<T> interfaceClass(Class<?> value)
When specified, only the list of properties defined on the interface class will be used during serialization.
Additional properties on subclasses will be ignored.
Note that this filter can be used on the parent class so that it filters to all child classes, or can be set individually on the child classes.
value
- The new value for this setting.public BeanFilterBuilder<T> stopClass(Class<?> value)
Identifies a stop class for this class and all subclasses.
Identical in purpose to the stop class specified by Introspector.getBeanInfo(Class, Class)
.
Any properties in the stop class or in its base classes will be ignored during analysis.
For example, in the following class hierarchy, instances of C3
will include property p3
,
but not p1
or p2
.
value
- The new value for this setting.public BeanFilterBuilder<T> sortProperties(boolean value)
When
Otherwise, the natural order of the bean properties is used which is dependent on the JVM vendor.
value
- The new value for this property.
public BeanFilterBuilder<T> sortProperties()
Shortcut for calling sortProperties(
.
public BeanFilterBuilder<T> fluentSetters(boolean value)
When enabled, fluent setters are detected on beans.
Fluent setters must have the following attributes:
value
- The new value for this property.
public BeanFilterBuilder<T> fluentSetters()
Shortcut for calling fluentSetters(
.
public BeanFilterBuilder<T> propertyNamer(Class<? extends PropertyNamer> value)
The class to use for calculating bean property names.
value
- The new value for this setting.
PropertyNamerDefault
.public BeanFilterBuilder<T> beanDictionary(Class<?>... values)
Adds to the list of classes that make up the bean dictionary for this bean.
values
- The values to add to this property.public BeanFilterBuilder<T> propertyFilter(Class<? extends PropertyFilter> value)
The property filter to use for intercepting and altering getter and setter calls.
value
- The new value for this setting.
PropertyFilter
.public BeanFilter build()
BeanFilter
with settings in this builder class.BeanFilter
instance.Copyright © 2018 Apache. All rights reserved.