I hate the fact that we started using Checkstyle.
Whose decision was that anyway..?
This commit is contained in:
parent
5934c2fd3b
commit
6871341291
4 changed files with 21 additions and 10 deletions
|
|
@ -485,7 +485,8 @@ public final class AnnotationParser<C> {
|
|||
builder = builder.senderType(senderType);
|
||||
}
|
||||
try {
|
||||
final MethodCommandExecutionHandler.CommandMethodContext<C> context = new MethodCommandExecutionHandler.CommandMethodContext<>(
|
||||
final MethodCommandExecutionHandler.CommandMethodContext<C> context =
|
||||
new MethodCommandExecutionHandler.CommandMethodContext<>(
|
||||
instance,
|
||||
commandArguments,
|
||||
method,
|
||||
|
|
@ -494,8 +495,9 @@ public final class AnnotationParser<C> {
|
|||
|
||||
/* Create the command execution handler */
|
||||
CommandExecutionHandler<C> commandExecutionHandler = new MethodCommandExecutionHandler<>(context);
|
||||
for (final Map.Entry<Predicate<Method>, Function<MethodCommandExecutionHandler.CommandMethodContext<C>, MethodCommandExecutionHandler<C>>> entry :
|
||||
commandMethodFactories.entrySet()) {
|
||||
for (final Map.Entry<Predicate<Method>, Function<MethodCommandExecutionHandler.CommandMethodContext<C>,
|
||||
MethodCommandExecutionHandler<C>>> entry
|
||||
: this.commandMethodFactories.entrySet()) {
|
||||
if (entry.getKey().test(method)) {
|
||||
commandExecutionHandler = entry.getValue().apply(context);
|
||||
|
||||
|
|
|
|||
|
|
@ -74,10 +74,12 @@ public class MethodCommandExecutionHandler<C> implements CommandExecutionHandler
|
|||
public void execute(final @NonNull CommandContext<C> commandContext) {
|
||||
/* Invoke the command method */
|
||||
try {
|
||||
this.methodHandle.invokeWithArguments(createParameterValues(
|
||||
commandContext,
|
||||
commandContext.flags(),
|
||||
true)
|
||||
this.methodHandle.invokeWithArguments(
|
||||
this.createParameterValues(
|
||||
commandContext,
|
||||
commandContext.flags(),
|
||||
true
|
||||
)
|
||||
);
|
||||
} catch (final Error e) {
|
||||
throw e;
|
||||
|
|
@ -86,7 +88,15 @@ public class MethodCommandExecutionHandler<C> implements CommandExecutionHandler
|
|||
}
|
||||
}
|
||||
|
||||
protected List<Object> createParameterValues(
|
||||
/**
|
||||
* Creates a list containing the values for all method parameters
|
||||
*
|
||||
* @param commandContext The context
|
||||
* @param flagContext The flag context
|
||||
* @param throwOnMissing Whether exceptions should be thrown on missing parameters
|
||||
* @return A list containing all parameters, in order
|
||||
*/
|
||||
protected final List<Object> createParameterValues(
|
||||
final CommandContext<C> commandContext,
|
||||
final FlagContext flagContext,
|
||||
final boolean throwOnMissing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue