Class PropertyReader


  • public final class PropertyReader
    extends Object
    Provides a object property reader utilties class.

    This class is derived from Apache Click.

    Since:
    5.0.0
    • Constructor Detail

      • PropertyReader

        public PropertyReader()
    • Method Detail

      • getValue

        public static Object getValue​(Object source,
                                      String name)
        Return the property value for the given object and property name. This method uses reflection internally to get the property value.

        This method is thread-safe, and caches reflected accessor methods in an internal synchronized cache.

        If the given source object is a Map this method will simply return the value for the given key name.

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

        public static Object getValue​(Object source,
                                      String name,
                                      Map cache)
        Return the property value for the given object and property name. This method uses reflection internally to get the property value.

        This method is thread-safe, and caches reflected accessor methods in an internal synchronized cache.

        If the given source object is a Map this method will simply return the value for the given key name.

        Parameters:
        source - the source object
        name - the name of the property
        cache - the method reflection cache
        Returns:
        the property value for the given source object and property name
      • getObjectValue

        public static Object getObjectValue​(Object source,
                                            String name,
                                            Map cache)
        Return the property value for the given object and property name. This method uses reflection internally to get the property value.

        This method is thread-safe, and caches reflected accessor methods in an internal synchronized cache.

        If the given source object is a Map this method will try return the value for the given key name respecting the dots.

        Parameters:
        source - the source object
        name - the name of the property
        cache - the method reflection cache
        Returns:
        the property value for the given source object and property name
        Since:
        5.0.1