Class BeanValueProvider

java.lang.Object
rs.baselib.util.BeanValueProvider
All Implemented Interfaces:
IValueProvider

public class BeanValueProvider extends 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 Details

    • BeanValueProvider

      public BeanValueProvider(String beanProperty)
      Constructor.
      Parameters:
      beanProperty - the name of the bean property to return
  • Method Details

    • getValue

      public Object getValue(Object o)
      Return the value for the given object.
      Specified by:
      getValue in interface IValueProvider
      Parameters:
      o - the object
      Returns:
      the value from the object.
    • getBeanProperty

      public String getBeanProperty()
      Returns the beanProperty.
      Returns:
      the beanProperty
    • setBeanProperty

      public void setBeanProperty(String beanProperty)
      Sets the beanProperty.
      Parameters:
      beanProperty - the beanProperty to set
    • getNullValue

      public Object getNullValue()
      Returns the nullValue.
      Returns:
      the nullValue
    • setNullValue

      public void setNullValue(Object nullValue)
      Sets the nullValue.
      Parameters:
      nullValue - the nullValue to set
    • getValueProviders

      public static BeanValueProvider[] getValueProviders(String... beanProperties)
      Helper method to convert list of properties to value providers.
      Parameters:
      beanProperties - the bean properties
      Returns:
      array of value providers for the bean properties