Polishing

This commit is contained in:
Juergen Hoeller
2018-06-13 22:04:10 +02:00
parent 3fc8ec498c
commit 0dc434b35e
4 changed files with 32 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,21 +38,40 @@ public class ScheduledMethodRunnable implements Runnable {
private final Method method;
/**
* Create a {@code ScheduledMethodRunnable} for the given target instance,
* calling the specified method.
* @param target the target instance to call the method on
* @param method the target method to call
*/
public ScheduledMethodRunnable(Object target, Method method) {
this.target = target;
this.method = method;
}
/**
* Create a {@code ScheduledMethodRunnable} for the given target instance,
* calling the specified method by name.
* @param target the target instance to call the method on
* @param methodName the name of the target method
* @throws NoSuchMethodException if the specified method does not exist
*/
public ScheduledMethodRunnable(Object target, String methodName) throws NoSuchMethodException {
this.target = target;
this.method = target.getClass().getMethod(methodName);
}
/**
* Return the target instance to call the method on.
*/
public Object getTarget() {
return this.target;
}
/**
* Return the target method to call.
*/
public Method getMethod() {
return this.method;
}