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.String getBeanProperty()
    Returns the beanProperty.
    java.lang.Object getNullValue()
    Returns the nullValue.
    java.lang.Object getValue​(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.
    void setBeanProperty​(java.lang.String beanProperty)
    Sets the beanProperty.
    void setNullValue​(java.lang.Object nullValue)
    Sets the nullValue.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      getValue in interface IValueProvider
      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

      public static BeanValueProvider[] getValueProviders​(java.lang.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