Package rs.baselib.util
Class BeanValueProvider
java.lang.Object
rs.baselib.util.BeanValueProvider
- All Implemented Interfaces:
IValueProvider
public class BeanValueProvider extends java.lang.Object implements 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
Constructors Constructor Description BeanValueProvider(java.lang.String beanProperty)Constructor. -
Method Summary
Modifier and Type Method Description java.lang.StringgetBeanProperty()Returns the beanProperty.java.lang.ObjectgetNullValue()Returns the nullValue.java.lang.ObjectgetValue(java.lang.Object o)Return the value for the given object.static BeanValueProvider[]getValueProviders(java.lang.String... beanProperties)Helper method to convert list of properties to value providers.voidsetBeanProperty(java.lang.String beanProperty)Sets the beanProperty.voidsetNullValue(java.lang.Object nullValue)Sets the nullValue.
-
Constructor Details
-
BeanValueProvider
public BeanValueProvider(java.lang.String beanProperty)Constructor.- Parameters:
beanProperty- the name of the bean property to return
-
-
Method Details
-
getValue
public java.lang.Object getValue(java.lang.Object o)Return the value for the given object.- Specified by:
getValuein interfaceIValueProvider- Parameters:
o- the object- Returns:
- the value from the object.
-
getBeanProperty
public java.lang.String getBeanProperty()Returns the beanProperty.- Returns:
- the beanProperty
-
setBeanProperty
public void setBeanProperty(java.lang.String beanProperty)Sets the beanProperty.- Parameters:
beanProperty- the beanProperty to set
-
getNullValue
public java.lang.Object getNullValue()Returns the nullValue.- Returns:
- the nullValue
-
setNullValue
public void setNullValue(java.lang.Object nullValue)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
-