Example usage for org.springframework.util ReflectionUtils invokeMethod

List of usage examples for org.springframework.util ReflectionUtils invokeMethod

Introduction

In this page you can find the example usage for org.springframework.util ReflectionUtils invokeMethod.

Prototype

@Nullable
public static Object invokeMethod(Method method, @Nullable Object target) 

Source Link

Document

Invoke the specified Method against the supplied target object with no arguments.

Usage

From source file:org.squashtest.tm.domain.event.RequirementModificationEventPublisherAspect.java

private Object readOldValue(RequirementVersion req, String propertyName) {
    try {/*from ww w.  j  a  va 2  s.  c  o m*/
        Method propertyGetter = RequirementVersion.class.getMethod("get" + WordUtils.capitalize(propertyName));
        return ReflectionUtils.invokeMethod(propertyGetter, req);

    } catch (NoSuchMethodException e) {
        ReflectionUtils.handleReflectionException(e);
    }

    // this should never happen - the catch block rethows an exception
    return null;
}