use of com.puppycrawl.tools.checkstyle.api.AutomaticBean in project checkstyle by checkstyle.
the class Checker method setupChild.
@Override
protected void setupChild(Configuration childConf) throws CheckstyleException {
final String name = childConf.getName();
final Object child;
try {
child = moduleFactory.createModule(name);
if (child instanceof AutomaticBean) {
final AutomaticBean bean = (AutomaticBean) child;
bean.contextualize(childContext);
bean.configure(childConf);
}
} catch (final CheckstyleException ex) {
throw new CheckstyleException("cannot initialize module " + name + " - " + ex.getMessage(), ex);
}
if (child instanceof FileSetCheck) {
final FileSetCheck fsc = (FileSetCheck) child;
fsc.init();
addFileSetCheck(fsc);
} else if (child instanceof BeforeExecutionFileFilter) {
final BeforeExecutionFileFilter filter = (BeforeExecutionFileFilter) child;
addBeforeExecutionFileFilter(filter);
} else if (child instanceof Filter) {
final Filter filter = (Filter) child;
addFilter(filter);
} else if (child instanceof AuditListener) {
final AuditListener listener = (AuditListener) child;
addListener(listener);
} else {
throw new CheckstyleException(name + " is not allowed as a child in Checker");
}
}
Aggregations