if (!hasJettyPlugin(method)) {
throw new IllegalArgumentException("at least " + method.getDeclaringClass() + " should be annotated with "
+ JettyRunWar.class);
}
final JettyRunWar methodAnno = method.getAnnotation(JettyRunWar.class);
final boolean isMethodDefaultConfig = DefaultConfig.DEFAULT_CONFIG_CLASS.equals((methodAnno == null)
? null
: methodAnno.value());
final JettyRunWar classAnno = method.getDeclaringClass().getAnnotation(JettyRunWar.class);
final boolean isClassDefaultConfig = DefaultConfig.DEFAULT_CONFIG_CLASS.equals((classAnno == null)
? null
: classAnno.value());
if (isClassDefaultConfig && isMethodDefaultConfig) {
throw new IllegalArgumentException(method + " should not be annotated with " + JettyRunWar.class
+ " because it has the same configuration has its class " + method.getDeclaringClass());
}
if (!isClassDefaultConfig && isMethodDefaultConfig) {
throw new IllegalArgumentException(method + " must be annotated with " + JettyRunWar.class
+ " and has a custom configuration because its class " + method.getDeclaringClass()
+ " has a custom configuration");
}
final JettyRunWar sourceConfig = firstNonNull(methodAnno, classAnno);
return configFrom(sourceConfig, method, method.getDeclaringClass());
}