Class BeanPropertyUtils

java.lang.Object
org.apache.empire.commons.BeanPropertyUtils

public final class BeanPropertyUtils extends Object
BeanPropertyUtils provides methods for getting and setting bean property values It is a replacement for org.apache.commons.beanutils.BeanUtils
Author:
rainer
  • Constructor Details

    • BeanPropertyUtils

      public BeanPropertyUtils()
  • Method Details

    • getImplementation

      public static BeanPropertyUtils.BeanPropertyUtilsImpl getImplementation()
      Returns the BeanUtils implementation
      Returns:
      the new BeanUtils implementation
    • setImplementation

      public static void setImplementation(BeanPropertyUtils.BeanPropertyUtilsImpl utils)
      Allows to override the implementation
      Parameters:
      utils - the new BeanUtils implementation
    • hasProperty

      public static int hasProperty(Object bean, String property, boolean writeAccess)
      Checks if a bean has a particular property and a corresponding getter/setter method exists
      Parameters:
      bean - the bean to check
      property - the property to check
      writeAccess - flag whether to check for the getter method (false) or the setter method (true)
      Returns:
      1 if the getter/setter exists, 0 if the getter/setter does not exist, and -1 if the property does not exist at all
    • getProperty

      public static Object getProperty(Object bean, String property)
      Returns the property of a bean by calling the correponding getter function
      Parameters:
      bean - the bean
      property - the property name
      Returns:
      the property value
    • setProperty

      public static boolean setProperty(Object bean, String property, Object value)
      Set a single property value of a java bean object used by readProperties. Return false if the property does not exist or if no setter method exists (read only) throws BeanPropertySetException if an error occurs in the setter method
      Parameters:
      bean - the bean
      property - the property
      value - the value
      Returns:
      true if the property has been set or false if the property does not exist or if no setter method exists
    • convertPropertyValue

      public static Object convertPropertyValue(Object value, Class<?> type)
      Converts a bean property value to a specific Java type
      Parameters:
      value - the value to convert
      type - the type
      Returns:
      the converted value