30 lines
730 B
Java
30 lines
730 B
Java
package dev.kske.chess.event;
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.Method;
|
|
|
|
/**
|
|
* Project: <strong>Chess</strong><br>
|
|
* File: <strong>Invocation.java</strong><br>
|
|
* Created: <strong>02.08.2019</strong><br>
|
|
* Author: <strong>Kai S. K. Engelbart</strong>
|
|
*/
|
|
public final class Invocation {
|
|
|
|
private final Method method;
|
|
private final Object object;
|
|
|
|
public Invocation(Method method, Object object) {
|
|
this.method = method;
|
|
this.object = object;
|
|
}
|
|
|
|
public void invoke(Object arg) {
|
|
try {
|
|
method.invoke(object, arg);
|
|
} catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException ex) {
|
|
ex.printStackTrace();
|
|
}
|
|
}
|
|
}
|