• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ModuleFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.puppycrawl.tools.checkstyle.ModuleFactory的典型用法代码示例。如果您正苦于以下问题:Java ModuleFactory类的具体用法?Java ModuleFactory怎么用?Java ModuleFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ModuleFactory类属于com.puppycrawl.tools.checkstyle包,在下文中一共展示了ModuleFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testAllCheckSectionsEx

import com.puppycrawl.tools.checkstyle.ModuleFactory; //导入依赖的package包/类
/**
 * Test contains asserts in callstack, but idea does not see them.
 * @noinspection JUnitTestMethodWithNoAssertions
 */
@Test
public void testAllCheckSectionsEx() throws Exception {
    final ModuleFactory moduleFactory = TestUtil.getPackageObjectFactory();

    final Path path = Paths.get(XdocUtil.DIRECTORY_PATH + "/config.xml");
    final String fileName = path.getFileName().toString();

    final String input = new String(Files7.readAllBytes(path), UTF_8);
    final Document document = XmlUtil.getRawXml(fileName, input, input);
    final NodeList sources = document.getElementsByTagName("section");

    for (int position = 0; position < sources.getLength(); position++) {
        final Node section = sources.item(position);
        final String sectionName = section.getAttributes().getNamedItem("name")
                .getNodeValue();

        if (!"Checker".equals(sectionName) && !"TreeWalker".equals(sectionName)) {
            continue;
        }

        validateCheckSection(moduleFactory, fileName, sectionName, section);
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:28,代码来源:XdocsPagesTest.java


示例2: testAllCheckSectionsEx

import com.puppycrawl.tools.checkstyle.ModuleFactory; //导入依赖的package包/类
/**
 * Test contains asserts in callstack, but idea does not see them.
 * @noinspection JUnitTestMethodWithNoAssertions
 */
@Test
public void testAllCheckSectionsEx() throws Exception {
    final ModuleFactory moduleFactory = TestUtil.getPackageObjectFactory();

    final Path path = Paths.get(XdocUtil.DIRECTORY_PATH + "/config.xml");
    final String fileName = path.getFileName().toString();

    final String input = new String(Files.readAllBytes(path), UTF_8);
    final Document document = XmlUtil.getRawXml(fileName, input, input);
    final NodeList sources = document.getElementsByTagName("section");

    for (int position = 0; position < sources.getLength(); position++) {
        final Node section = sources.item(position);
        final String sectionName = section.getAttributes().getNamedItem("name")
                .getNodeValue();

        if (!"Checker".equals(sectionName) && !"TreeWalker".equals(sectionName)) {
            continue;
        }

        validateCheckSection(moduleFactory, fileName, sectionName, section);
    }
}
 
开发者ID:checkstyle,项目名称:checkstyle,代码行数:28,代码来源:XdocsPagesTest.java


示例3: setModuleFactory

import com.puppycrawl.tools.checkstyle.ModuleFactory; //导入依赖的package包/类
/**
 * Sets the module factory for creating child modules (Checks).
 * @param aModuleFactory the factory
 */
public void setModuleFactory(ModuleFactory aModuleFactory)
{
    mModuleFactory = aModuleFactory;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:ClassFileSetCheck.java


示例4: testAllCheckSections

import com.puppycrawl.tools.checkstyle.ModuleFactory; //导入依赖的package包/类
@Test
public void testAllCheckSections() throws Exception {
    final ModuleFactory moduleFactory = TestUtil.getPackageObjectFactory();

    for (Path path : XdocUtil.getXdocsConfigFilePaths(XdocUtil.getXdocsFilePaths())) {
        final String fileName = path.getFileName().toString();

        if ("config_reporting.xml".equals(fileName)) {
            continue;
        }

        final String input = new String(Files7.readAllBytes(path), UTF_8);
        final Document document = XmlUtil.getRawXml(fileName, input, input);
        final NodeList sources = document.getElementsByTagName("section");
        String lastSectionName = null;

        for (int position = 0; position < sources.getLength(); position++) {
            final Node section = sources.item(position);
            final String sectionName = section.getAttributes().getNamedItem("name")
                    .getNodeValue();

            if ("Content".equals(sectionName) || "Overview".equals(sectionName)) {
                Assert.assertNull(fileName + " section '" + sectionName + "' should be first",
                        lastSectionName);
                continue;
            }

            Assert.assertTrue(fileName + " section '" + sectionName
                    + "' shouldn't end with 'Check'", !sectionName.endsWith("Check"));
            if (lastSectionName != null) {
                Assert.assertTrue(
                        fileName + " section '" + sectionName
                                + "' is out of order compared to '" + lastSectionName + "'",
                        sectionName.toLowerCase(Locale.ENGLISH).compareTo(
                                lastSectionName.toLowerCase(Locale.ENGLISH)) >= 0);
            }

            validateCheckSection(moduleFactory, fileName, sectionName, section);

            lastSectionName = sectionName;
        }
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:44,代码来源:XdocsPagesTest.java


示例5: validateCheckSection

import com.puppycrawl.tools.checkstyle.ModuleFactory; //导入依赖的package包/类
private static void validateCheckSection(ModuleFactory moduleFactory, String fileName,
        String sectionName, Node section) throws Exception {
    final Object instance;

    try {
        instance = moduleFactory.createModule(sectionName);
    }
    catch (CheckstyleException ex) {
        throw new CheckstyleException(fileName + " couldn't find class: " + sectionName, ex);
    }

    int subSectionPos = 0;
    for (Node subSection : XmlUtil.getChildrenElements(section)) {
        final String subSectionName = subSection.getAttributes().getNamedItem("name")
                .getNodeValue();

        // can be in different orders, and completely optional
        if ("Notes".equals(subSectionName)
                || "Rule Description".equals(subSectionName)) {
            continue;
        }

        // optional sections that can be skipped if they have nothing to report
        if (subSectionPos == 1 && !"Properties".equals(subSectionName)) {
            validatePropertySection(fileName, sectionName, null, instance);
            subSectionPos++;
        }
        if (subSectionPos == 4 && !"Error Messages".equals(subSectionName)) {
            validateErrorSection(fileName, sectionName, null, instance);
            subSectionPos++;
        }

        Assert.assertEquals(fileName + " section '" + sectionName
                + "' should be in order", getSubSectionName(subSectionPos),
                subSectionName);

        switch (subSectionPos) {
            case 0:
                validateSinceDescriptionSection(fileName, sectionName, subSection);
                break;
            case 1:
                validatePropertySection(fileName, sectionName, subSection, instance);
                break;
            case 2:
                break;
            case 3:
                validateUsageExample(fileName, sectionName, subSection);
                break;
            case 4:
                validateErrorSection(fileName, sectionName, subSection, instance);
                break;
            case 5:
                validatePackageSection(fileName, sectionName, subSection, instance);
                break;
            case 6:
                validateParentSection(fileName, sectionName, subSection);
                break;
            default:
                break;
        }

        subSectionPos++;
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:65,代码来源:XdocsPagesTest.java


示例6: getRootModule

import com.puppycrawl.tools.checkstyle.ModuleFactory; //导入依赖的package包/类
private RootModule getRootModule(String name, ClassLoader moduleClassLoader) throws CheckstyleException {
	ModuleFactory factory = new PackageObjectFactory(Checker.class.getPackage().getName() + ".", moduleClassLoader);
	return (RootModule) factory.createModule(name);
}
 
开发者ID:visminer,项目名称:repositoryminer,代码行数:5,代码来源:CheckStyleExecutor.java


示例7: testAllCheckSections

import com.puppycrawl.tools.checkstyle.ModuleFactory; //导入依赖的package包/类
@Test
public void testAllCheckSections() throws Exception {
    final ModuleFactory moduleFactory = TestUtil.getPackageObjectFactory();

    for (Path path : XdocUtil.getXdocsConfigFilePaths(XdocUtil.getXdocsFilePaths())) {
        final String fileName = path.getFileName().toString();

        if ("config_reporting.xml".equals(fileName)) {
            continue;
        }

        final String input = new String(Files.readAllBytes(path), UTF_8);
        final Document document = XmlUtil.getRawXml(fileName, input, input);
        final NodeList sources = document.getElementsByTagName("section");
        String lastSectionName = null;

        for (int position = 0; position < sources.getLength(); position++) {
            final Node section = sources.item(position);
            final String sectionName = section.getAttributes().getNamedItem("name")
                    .getNodeValue();

            if ("Content".equals(sectionName) || "Overview".equals(sectionName)) {
                Assert.assertNull(fileName + " section '" + sectionName + "' should be first",
                        lastSectionName);
                continue;
            }

            Assert.assertTrue(fileName + " section '" + sectionName
                    + "' shouldn't end with 'Check'", !sectionName.endsWith("Check"));
            if (lastSectionName != null) {
                Assert.assertTrue(
                        fileName + " section '" + sectionName
                                + "' is out of order compared to '" + lastSectionName + "'",
                        sectionName.toLowerCase(Locale.ENGLISH).compareTo(
                                lastSectionName.toLowerCase(Locale.ENGLISH)) >= 0);
            }

            validateCheckSection(moduleFactory, fileName, sectionName, section);

            lastSectionName = sectionName;
        }
    }
}
 
开发者ID:checkstyle,项目名称:checkstyle,代码行数:44,代码来源:XdocsPagesTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NiftyInputEvent类代码示例发布时间:2022-05-22
下一篇:
Java BulkWriteError类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap