Renamed Parameters#call to #usingOn

This commit is contained in:
Rsl1122 2020-01-26 23:00:56 +02:00
parent 43f18c78aa
commit 274bd2755b
2 changed files with 6 additions and 6 deletions

View File

@ -41,9 +41,9 @@ public class MethodWrapper<T> {
methodType = MethodType.forMethod(this.method); methodType = MethodType.forMethod(this.method);
} }
public T callMethod(DataExtension of, Parameters with) { public T callMethod(DataExtension extension, Parameters with) {
try { try {
return returnType.cast(with.call(of, method)); return returnType.cast(with.usingOn(extension, method));
} catch (InvocationTargetException notReadyToBeCalled) { } catch (InvocationTargetException notReadyToBeCalled) {
if (notReadyToBeCalled.getCause() instanceof NotReadyException) { if (notReadyToBeCalled.getCause() instanceof NotReadyException) {
return null; // Data or API not available to make the call. return null; // Data or API not available to make the call.

View File

@ -37,7 +37,7 @@ public interface Parameters {
return new GroupParameters(serverUUID, groupName); return new GroupParameters(serverUUID, groupName);
} }
Object call(DataExtension extension, Method method) throws InvocationTargetException, IllegalAccessException; Object usingOn(DataExtension extension, Method method) throws InvocationTargetException, IllegalAccessException;
MethodType getMethodType(); MethodType getMethodType();
@ -59,7 +59,7 @@ public interface Parameters {
} }
@Override @Override
public Object call(DataExtension extension, Method method) throws InvocationTargetException, IllegalAccessException { public Object usingOn(DataExtension extension, Method method) throws InvocationTargetException, IllegalAccessException {
return method.invoke(extension); return method.invoke(extension);
} }
@ -89,7 +89,7 @@ public interface Parameters {
} }
@Override @Override
public Object call(DataExtension extension, Method method) throws InvocationTargetException, IllegalAccessException { public Object usingOn(DataExtension extension, Method method) throws InvocationTargetException, IllegalAccessException {
Class<?> parameterType = method.getParameterTypes()[0]; Class<?> parameterType = method.getParameterTypes()[0];
if (UUID.class.equals(parameterType)) { if (UUID.class.equals(parameterType)) {
return method.invoke(extension, playerUUID); return method.invoke(extension, playerUUID);
@ -118,7 +118,7 @@ public interface Parameters {
} }
@Override @Override
public Object call(DataExtension extension, Method method) throws InvocationTargetException, IllegalAccessException { public Object usingOn(DataExtension extension, Method method) throws InvocationTargetException, IllegalAccessException {
Group group = this::getGroupName; Group group = this::getGroupName;
return method.invoke(extension, group); return method.invoke(extension, group);
} }