Polishing
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user