当前位置: 首页>>代码示例>>Java>>正文


Java Configuration.getName方法代码示例

本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.Configuration.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.getName方法的具体用法?Java Configuration.getName怎么用?Java Configuration.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.puppycrawl.tools.checkstyle.api.Configuration的用法示例。


在下文中一共展示了Configuration.getName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupChild

import com.puppycrawl.tools.checkstyle.api.Configuration; //导入方法依赖的package包/类
/**
 * Instantiates, configures and registers a Check that is specified
 * in the provided configuration.
 * @see com.puppycrawl.tools.checkstyle.api.AutomaticBean
 */
public void setupChild(Configuration aChildConf)
    throws CheckstyleException
{
    // TODO: improve the error handing
    final String name = aChildConf.getName();
    final Object module = mModuleFactory.createModule(name);
    if (!(module instanceof AbstractCheckVisitor)) {
        throw new CheckstyleException(
            "ClassFileSet is not allowed as a parent of " + name);
    }
    final AbstractCheckVisitor c = (AbstractCheckVisitor) module;
    c.contextualize(mChildContext);
    c.configure(aChildConf);
    c.init();

    registerCheck(c);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:ClassFileSetCheck.java

示例2: createChecker

import com.puppycrawl.tools.checkstyle.api.Configuration; //导入方法依赖的package包/类
/**
 * Creates {@link Checker} instance based on the given {@link Configuration} instance.
 * @param moduleConfig {@link Configuration} instance.
 * @return {@link Checker} instance based on the given {@link Configuration} instance.
 * @throws Exception if an exception occurs during checker configuration.
 */
public final Checker createChecker(Configuration moduleConfig)
        throws Exception {
    if (checkstyleModules == null) {
        checkstyleModules = CheckUtil.getCheckstyleModules();
    }

    final String name = moduleConfig.getName();
    ModuleCreationOption moduleCreationOption = ModuleCreationOption.IN_CHECKER;

    for (Class<?> moduleClass : checkstyleModules) {
        if (moduleClass.getSimpleName().equals(name)
                || moduleClass.getSimpleName().equals(name + "Check")) {
            if (ModuleReflectionUtils.isCheckstyleTreeWalkerCheck(moduleClass)
                    || ModuleReflectionUtils.isTreeWalkerFilterModule(moduleClass)) {
                moduleCreationOption = ModuleCreationOption.IN_TREEWALKER;
            }
            break;
        }
    }

    return createChecker(moduleConfig, moduleCreationOption);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:29,代码来源:AbstractModuleTestSupport.java

示例3: createChecker

import com.puppycrawl.tools.checkstyle.api.Configuration; //导入方法依赖的package包/类
/**
 * Creates {@link Checker} instance based on the given {@link Configuration} instance.
 * @param moduleConfig {@link Configuration} instance.
 * @return {@link Checker} instance based on the given {@link Configuration} instance.
 * @throws Exception if an exception occurs during checker configuration.
 */
public final Checker createChecker(Configuration moduleConfig)
        throws Exception {
    ModuleCreationOption moduleCreationOption = ModuleCreationOption.IN_CHECKER;

    final String moduleName = moduleConfig.getName();
    if (!ROOT_MODULE_NAME.equals(moduleName)) {
        try {
            final Class<?> moduleClass = Class.forName(moduleName);
            if (ModuleReflectionUtils.isCheckstyleTreeWalkerCheck(moduleClass)
                    || ModuleReflectionUtils.isTreeWalkerFilterModule(moduleClass)) {
                moduleCreationOption = ModuleCreationOption.IN_TREEWALKER;
            }
        }
        catch (ClassNotFoundException ignore) {
            // ignore exception, assume it is not part of TreeWalker
        }
    }

    return createChecker(moduleConfig, moduleCreationOption);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:27,代码来源:AbstractModuleTestSupport.java

示例4: endElement

import com.puppycrawl.tools.checkstyle.api.Configuration; //导入方法依赖的package包/类
@Override
public void endElement(String uri,
                       String localName,
                       String qName) throws SAXException {
    if (qName.equals(MODULE)) {

        final Configuration recentModule =
            configStack.pop();

        // get severity attribute if it exists
        SeverityLevel level = null;
        if (containsAttribute(recentModule, SEVERITY)) {
            try {
                final String severity = recentModule.getAttribute(SEVERITY);
                level = SeverityLevel.getInstance(severity);
            }
            catch (final CheckstyleException ex) {
                // [email protected][IllegalInstantiation] SAXException is in the overridden
                // method signature
                throw new SAXException(
                        "Problem during accessing '" + SEVERITY + "' attribute for "
                                + recentModule.getName(), ex);
            }
        }

        // omit this module if these should be omitted and the module
        // has the severity 'ignore'
        final boolean omitModule = omitIgnoredModules
            && level == SeverityLevel.IGNORE;

        if (omitModule && !configStack.isEmpty()) {
            final DefaultConfiguration parentModule =
                configStack.peek();
            parentModule.removeChild(recentModule);
        }
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:38,代码来源:ConfigurationLoader.java

示例5: setupChild

import com.puppycrawl.tools.checkstyle.api.Configuration; //导入方法依赖的package包/类
/**
 * {@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.");
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:31,代码来源:TreeWalker.java


注:本文中的com.puppycrawl.tools.checkstyle.api.Configuration.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。