Class PropertyUtils


  • public class PropertyUtils
    extends Object
    Provides Property Utilities.
    • Constructor Detail

      • PropertyUtils

        public PropertyUtils()
    • Method Detail

      • getValue

        public static Object getValue​(Object source,
                                      String name)
        Return the property value for the given object and property name using the MVEL library.

        This method is thread-safe, and caches parsed MVEL expressions in an cache.

        Parameters:
        source - the source object
        name - the name of the property
        Returns:
        the property value for the given source object and property name
      • setValue

        public static void setValue​(Object target,
                                    String name,
                                    Object value)
        Return the property value for the given object and property name using the MVEL library.

        This method is thread-safe, and caches parsed MVEL expressions in an cache.

        Parameters:
        target - the target object to set the property of
        name - the name of the property to set
        value - the property value to set
      • setValue

        public static void setValue​(Object target,
                                    String name,
                                    Object value,
                                    boolean logErrors)
        Return the property value for the given object and property name using the MVEL library.

        This method is thread-safe, and caches parsed MVEL expressions in an cache.

        Parameters:
        target - the target object to set the property of
        name - the name of the property to set
        value - the property value to set
        logErrors - log any property setting errors
      • hasSetterMethod

        public static boolean hasSetterMethod​(Object object,
                                              String propertyName)
        Return true if the given object has the setter method with the given property name.
        Parameters:
        object - the target object to test
        propertyName - the property name to test
        Returns:
        true if the given object has the setter method with the given property name
        Since:
        4.2.0