+ command.scope() + ":"
+ INTENSITY_BOLD + command.name() + INTENSITY_NORMAL
+ ": unable to convert option "
+ INTENSITY_BOLD + entry.getKey().name() + INTENSITY_NORMAL
+ " with value '" + entry.getValue() + "' to type "
+ new GenericType(field.getGenericType()).toString()
+ COLOR_DEFAULT,
"Unable to convert option " + entry.getKey().name() + " with value '"
+ entry.getValue() + "' to type " + new GenericType(field.getGenericType()).toString(),
e
);
} else {
throw new CommandException("Unable to convert option " + entry.getKey().name() + " with value '"
+ entry.getValue() + "' to type " + new GenericType(field.getGenericType()).toString(),
e);
}
}
field.setAccessible(true);
field.set(action, value);
}
for (Map.Entry<Argument, Object> entry : argumentValues.entrySet()) {
Field field = arguments.get(entry.getKey());
Object value;
try {
value = convert(action, session, entry.getValue(), field.getGenericType());
} catch (Exception e) {
Command command = action.getClass().getAnnotation(Command.class);
if (command != null) {
throw new CommandException(COLOR_RED
+ "Error executing command "
+ command.scope() + ":"
+ INTENSITY_BOLD + command.name() + INTENSITY_NORMAL
+ ": unable to convert argument "
+ INTENSITY_BOLD + entry.getKey().name() + INTENSITY_NORMAL
+ " with value '" + entry.getValue() + "' to type "
+ new GenericType(field.getGenericType()).toString()
+ COLOR_DEFAULT,
"Unable to convert argument " + entry.getKey().name() + " with value '"
+ entry.getValue() + "' to type " + new GenericType(field.getGenericType()).toString(),
e
);
} else {
throw new CommandException("Unable to convert argument " + entry.getKey().name() + " with value '"
+ entry.getValue() + "' to type " + new GenericType(field.getGenericType()).toString(),
e);
}
}
field.setAccessible(true);
field.set(action, value);