Compare commits
2 Commits
a46e856257
...
d6caa1b1d7
| Author | SHA1 | Date |
|---|---|---|
|
|
d6caa1b1d7 | |
|
|
5ce8f4ca2a |
|
|
@ -66,14 +66,17 @@ public class DelegateActionManager {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private ActionHandler instantiateHandler(Class<?> clazz) throws Exception {
|
private ActionHandler instantiateHandler(Class<?> clazz) throws Exception {
|
||||||
|
if(!ActionHandler.class.isAssignableFrom(clazz)){
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
clazz.getName() + " is annotated with @Action but does not implement ActionHandler");
|
||||||
|
|
||||||
|
}
|
||||||
logger.debug("Attempting to instantiate handler: {}", clazz.getSimpleName());
|
logger.debug("Attempting to instantiate handler: {}", clazz.getSimpleName());
|
||||||
|
|
||||||
|
|
||||||
Constructor<?>[] constructors = clazz.getDeclaredConstructors();
|
Constructor<?>[] constructors = clazz.getDeclaredConstructors();
|
||||||
|
|
||||||
|
|
||||||
Constructor<?>[] constructors = clazz.getDeclaredConstructors();
|
|
||||||
|
|
||||||
// Sort constructors by parameter count (descending) to prefer DI constructors
|
// Sort constructors by parameter count (descending) to prefer DI constructors
|
||||||
java.util.Arrays.sort(constructors, (c1, c2) ->
|
java.util.Arrays.sort(constructors, (c1, c2) ->
|
||||||
Integer.compare(c2.getParameterCount(), c1.getParameterCount()));
|
Integer.compare(c2.getParameterCount(), c1.getParameterCount()));
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Action( "genre.getById")
|
@Action("genre.getById")
|
||||||
public class GetGenreByIdHandler implements ActionHandler {
|
public class GetGenreByIdHandler implements ActionHandler {
|
||||||
private static final Logger logger = LogManager.getLogger(GetGenreByIdHandler.class);
|
private static final Logger logger = LogManager.getLogger(GetGenreByIdHandler.class);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue