public interface BeanStyleHandler
BeanStyleHandlers are used by the ProxyIBeanFactory to deal
with BeanStyles that differ from the classic bean style in their
runtime behavior.
BeanStyleHandlerss are necessary in two cases:
void.
If you want to provide your own bean style and at least one of the two
conditions above match to your custom bean style then you need to also
provide a BeanStyleHandler. Style and its matching handler are
configured when assembling a ProxyIBeanFactory using method
ProxyIBeanFactory.Builder.withBeanStyle(BeanStyle, BeanStyleHandler).
| Modifier and Type | Field and Description |
|---|---|
static BeanStyleHandler |
CLASSIC_WITH_OPTIONAL_SUPPORT_HANDLER
BeanStyleHandler for
ClassicBeanStyleWithOptionalSupport. |
static BeanStyleHandler |
DEFAULT_HANDLER
BeanStyleHandler for ClassicBeanStyle. |
static BeanStyleHandler |
MODERN_HANDLER
BeanStyleHandler for ModernBeanStyle. |
| Modifier and Type | Method and Description |
|---|---|
default Object |
convertReturnValueOfGetterCall(Class<?> expectedReturnType,
Object returnValueWithWrongType)
This method is called during runtime of a bean, more precisely, always
when getters of a bean are called to adjust the type of the return value
of the getter method.
|
default Object |
createReturnValueForSetterCall(Object instance,
Method setterMethod,
Object newValue)
This method is called during runtime of a bean, more precisely, always
when setters of a bean are called to assemble the return value of the
setter method.
|
static final BeanStyleHandler DEFAULT_HANDLER
BeanStyleHandler for ClassicBeanStyle.static final BeanStyleHandler CLASSIC_WITH_OPTIONAL_SUPPORT_HANDLER
BeanStyleHandler for
ClassicBeanStyleWithOptionalSupport.static final BeanStyleHandler MODERN_HANDLER
BeanStyleHandler for ModernBeanStyle.default Object createReturnValueForSetterCall(Object instance, Method setterMethod, Object newValue)
void. Therefore this method only needs to be
implemented for those type of bean styles. This default implementation
throws IllegalStateException.
See ModernBeanStyle for a concrete implementation of this method.
instance - the IBean instancesetterMethod - the setter method in whose return value should be creatednewValue - the new value of the field, given as a parameter to the setterdefault Object convertReturnValueOfGetterCall(Class<?> expectedReturnType, Object returnValueWithWrongType)
IllegalStateException.
See ModernBeanStyle for a concrete implementation of this method.
expectedReturnType - the type the field value needs to be converted toreturnValueWithWrongType - the field value that needs to be converted