com.puppycrawl.tools.checkstyle.PackageObjectFactory Java Examples
The following examples show how to use
com.puppycrawl.tools.checkstyle.PackageObjectFactory.
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 |
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: CheckFilter.java From spring-javaformat with Apache License 2.0 | 5 votes |
private ModuleFactory createModuleFactory() { try { ClassLoader classLoader = AbstractCheck.class.getClassLoader(); Set<String> packageNames = PackageNamesLoader.getPackageNames(classLoader); return new PackageObjectFactory(packageNames, classLoader); } catch (CheckstyleException ex) { throw new IllegalStateException(ex); } }
Example #3
Source File: SpringChecksTests.java From spring-javaformat with Apache License 2.0 | 5 votes |
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 #4
Source File: SpringConfigurationLoaderTests.java From spring-javaformat with Apache License 2.0 | 5 votes |
private Collection<FileSetCheck> load(Set<String> excludes) { DefaultContext context = new DefaultContext(); ModuleFactory moduleFactory = new PackageObjectFactory(getClass().getPackage().getName(), getClass().getClassLoader()); moduleFactory = new FilteredModuleFactory(moduleFactory, excludes); context.add("moduleFactory", moduleFactory); Collection<FileSetCheck> checks = new SpringConfigurationLoader(context, moduleFactory) .load(getPropertyResolver()); return checks; }
Example #5
Source File: CheckStyleExecutor.java From repositoryminer with Apache License 2.0 | 4 votes |
private RootModule getRootModule(String name, ClassLoader moduleClassLoader) throws CheckstyleException { ModuleFactory factory = new PackageObjectFactory(Checker.class.getPackage().getName() + ".", moduleClassLoader); return (RootModule) factory.createModule(name); }
Example #6
Source File: Main.java From diff-check with GNU Lesser General Public License v2.1 | 3 votes |
/** * 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); }