Class BeanInterceptor<T>
- Type Parameters:
- T- The bean type.
- Direct Known Subclasses:
- BeanInterceptor.Void
Bean interceptors intercept calls to bean getters and setters to allow them to override values in transit.
Example:
   
Bean interceptors are registered in the following way:
Example:
   
See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classNon-existent bean interceptor.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final BeanInterceptor<Object>Default reusable property filter instance.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionreadProperty(T bean, String name, Object value) Property read interceptor.writeProperty(T bean, String name, Object value) Property write interceptor.
- 
Field Details- 
DEFAULTDefault reusable property filter instance.
 
- 
- 
Constructor Details- 
BeanInterceptorpublic BeanInterceptor()
 
- 
- 
Method Details- 
readPropertyProperty read interceptor.Subclasses can override this property to convert property values to some other object just before serialization. Example:// Address filter that strips out sensitive information. public class AddressInterceptorextends BeanInterceptor<Address> {public Object readProperty(Addressbean , Stringname , Objectvalue ) {if ("taxInfo" .equals(name ))return "redacted" ;return value ; } }- Parameters:
- bean- The bean from which the property was read.
- name- The property name.
- value- The value just extracted from calling the bean getter.
- Returns:
- The value to serialize. Default is just to return the existing value.
 
- 
writePropertyProperty write interceptor.Subclasses can override this property to convert property values to some other object just before calling the bean setter. Example:// Address filter that strips out sensitive information. public class AddressInterceptorextends BeanInterceptor<Address> {public Object writeProperty(Addressbean , Stringname , Objectvalue ) {if ("taxInfo" .equals(name ) &&"redacted" .equals(value ))return TaxInfoUtils.lookup (bean .getStreet(),bean .getCity(),bean .getState());return value ; } }- Parameters:
- bean- The bean from which the property was read.
- name- The property name.
- value- The value just parsed.
- Returns:
- The value to serialize. Default is just to return the existing value.
 
 
-