Class ReflectiveWorkOnChange

java.lang.Object
org.broadleafcommerce.common.util.ReflectiveWorkOnChange
All Implemented Interfaces:
WorkOnChange

public class ReflectiveWorkOnChange extends Object implements WorkOnChange
This WorkOnChange implementation is for a narrow case where the work to be done is simply calling a method on a target object and passing to that method the changed collection. Of course, there must be a method with the correct signature on the target object. This implementation also uses caching to optimize repeat searches for the same method and minimize reflection time.
Author:
Jeff Fischer
  • Constructor Details

    • ReflectiveWorkOnChange

      public ReflectiveWorkOnChange(Object target, String methodName)
  • Method Details

    • doWork

      public void doWork(Collection changed)
      Description copied from interface: WorkOnChange
      An implementation of this method will be called whenever a change is detected on a change aware collection. The implementation should contain whatever code is necessary to respond to the collection change.
      Specified by:
      doWork in interface WorkOnChange
      Parameters:
      changed - the un-proxied collection that was modified
    • searchForMethod

      protected Method searchForMethod(Class<?> targetClass, Object test)