Java Code Examples for com.puppycrawl.tools.checkstyle.ModuleFactory#createModule()

The following examples show how to use com.puppycrawl.tools.checkstyle.ModuleFactory#createModule() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NoHttpCheckITest.java    From nohttp with Apache License 2.0 5 votes vote down vote up
private RootModule createRootModule(Configuration configuration)
		throws CheckstyleException {
	ModuleFactory factory = new PackageObjectFactory(
			Checker.class.getPackage().getName(), getClass().getClassLoader());
	RootModule rootModule = (RootModule) factory
			.createModule(configuration.getName());
	rootModule.setModuleClassLoader(getClass().getClassLoader());
	rootModule.configure(configuration);
	return rootModule;
}
 
Example 2
Source File: SpringChecksTests.java    From spring-javaformat with Apache License 2.0 5 votes vote down vote up
private RootModule createRootModule(Configuration configuration) throws CheckstyleException {
	ModuleFactory factory = new PackageObjectFactory(Checker.class.getPackage().getName(),
			getClass().getClassLoader());
	RootModule rootModule = (RootModule) factory.createModule(configuration.getName());
	rootModule.setModuleClassLoader(getClass().getClassLoader());
	rootModule.configure(configuration);
	return rootModule;
}
 
Example 3
Source File: CheckStyleExecutor.java    From repositoryminer with Apache License 2.0 4 votes vote down vote up
private RootModule getRootModule(String name, ClassLoader moduleClassLoader) throws CheckstyleException {
	ModuleFactory factory = new PackageObjectFactory(Checker.class.getPackage().getName() + ".", moduleClassLoader);
	return (RootModule) factory.createModule(name);
}
 
Example 4
Source File: Main.java    From diff-check with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Creates a new instance of the root module that will control and run
 * Checkstyle.
 * @param name The name of the module. This will either be a short name that
 *        will have to be found or the complete package name.
 * @param moduleClassLoader Class loader used to load the root module.
 * @return The new instance of the root module.
 * @throws CheckstyleException if no module can be instantiated from name
 */
private static RootModule getRootModule(String name, ClassLoader moduleClassLoader)
        throws CheckstyleException {
    final ModuleFactory factory = new PackageObjectFactory(
            Checker.class.getPackage().getName(), moduleClassLoader);

    return (RootModule) factory.createModule(name);
}