本文整理汇总了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;未经允许,请勿转载。 |
请发表评论