Package rs.baselib.util
Class BeanValueProvider
java.lang.Object
rs.baselib.util.BeanValueProvider
- All Implemented Interfaces:
IValueProvider
Default bean implementation for
IValueProvider
.
The provider returns the value of the given bean property or - if NULL - the defined NULL value
which is NULL by default.
The provider will return the bean itself when the bean property is set to NULL.- Author:
- ralph
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the beanProperty.Returns the nullValue.Return the value for the given object.static BeanValueProvider[]
getValueProviders
(String... beanProperties) Helper method to convert list of properties to value providers.void
setBeanProperty
(String beanProperty) Sets the beanProperty.void
setNullValue
(Object nullValue) Sets the nullValue.
-
Constructor Details
-
BeanValueProvider
Constructor.- Parameters:
beanProperty
- the name of the bean property to return
-
-
Method Details
-
getValue
Return the value for the given object.- Specified by:
getValue
in interfaceIValueProvider
- Parameters:
o
- the object- Returns:
- the value from the object.
-
getBeanProperty
Returns the beanProperty.- Returns:
- the beanProperty
-
setBeanProperty
Sets the beanProperty.- Parameters:
beanProperty
- the beanProperty to set
-
getNullValue
Returns the nullValue.- Returns:
- the nullValue
-
setNullValue
Sets the nullValue.- Parameters:
nullValue
- the nullValue to set
-
getValueProviders
Helper method to convert list of properties to value providers.- Parameters:
beanProperties
- the bean properties- Returns:
- array of value providers for the bean properties
-