/** * Register a check for a specified token id. * @param tokenId the id of the token * @param check the check to register * @throws CheckstyleException if Check is misconfigured */ private void registerCheck(int tokenId, AbstractCheck check) throws CheckstyleException { registerCheck(TokenUtil.getTokenName(tokenId), check); }
final int tokenId = TokenUtil.getTokenId(token); if (Arrays.binarySearch(acceptableTokens, tokenId) >= 0) { registerCheck(token, check); registerCheck(element, check);
/** * {@inheritDoc} Creates child module. * @noinspection ChainOfInstanceofChecks */ @Override public void setupChild(Configuration childConf) throws CheckstyleException { final String name = childConf.getName(); final Object module = moduleFactory.createModule(name); if (module instanceof AutomaticBean) { final AutomaticBean bean = (AutomaticBean) module; bean.contextualize(childContext); bean.configure(childConf); } if (module instanceof AbstractCheck) { final AbstractCheck check = (AbstractCheck) module; check.init(); registerCheck(check); } else if (module instanceof TreeWalkerFilter) { final TreeWalkerFilter filter = (TreeWalkerFilter) module; filters.add(filter); } else { throw new CheckstyleException( "TreeWalker is not allowed as a parent of " + name + " Please review 'Parent Module' section for this Check in web" + " documentation if Check is standard."); } }
/** * Register a check for a specified token id. * @param tokenId the id of the token * @param check the check to register * @throws CheckstyleException if Check is misconfigured */ private void registerCheck(int tokenId, AbstractCheck check) throws CheckstyleException { registerCheck(TokenUtil.getTokenName(tokenId), check); }
final int tokenId = TokenUtil.getTokenId(token); if (Arrays.binarySearch(acceptableTokens, tokenId) >= 0) { registerCheck(token, check); registerCheck(element, check);
/** * {@inheritDoc} Creates child module. * @noinspection ChainOfInstanceofChecks */ @Override public void setupChild(Configuration childConf) throws CheckstyleException { final String name = childConf.getName(); final Object module = moduleFactory.createModule(name); if (module instanceof AutomaticBean) { final AutomaticBean bean = (AutomaticBean) module; bean.contextualize(childContext); bean.configure(childConf); } if (module instanceof AbstractCheck) { final AbstractCheck check = (AbstractCheck) module; check.init(); registerCheck(check); } else if (module instanceof TreeWalkerFilter) { final TreeWalkerFilter filter = (TreeWalkerFilter) module; filters.add(filter); } else { throw new CheckstyleException( "TreeWalker is not allowed as a parent of " + name + " Please review 'Parent Module' section for this Check in web" + " documentation if Check is standard."); } }