com.puppycrawl.tools.checkstyle.ModuleFactory Java Examples
The following examples show how to use
com.puppycrawl.tools.checkstyle.ModuleFactory.
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: SpringChecks.java From spring-javaformat with Apache License 2.0 | 5 votes |
@Override public void finishLocalSetup() { ModuleFactory moduleFactory = new FilteredModuleFactory(this.moduleFactory, this.excludes); DefaultContext context = new DefaultContext(); context.add("classLoader", this.classLoader); context.add("severity", getSeverity()); context.add("tabWidth", String.valueOf(getTabWidth())); context.add("moduleFactory", moduleFactory); Properties properties = new Properties(); put(properties, "headerType", this.headerType); put(properties, "headerCopyrightPattern", this.headerCopyrightPattern); put(properties, "headerFile", this.headerFile); put(properties, "projectRootPackage", this.projectRootPackage); this.checks = new SpringConfigurationLoader(context, moduleFactory).load(new PropertiesExpander(properties)); }
Example #3
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 #4
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 #5
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 #6
Source File: FilteredModuleFactory.java From spring-javaformat with Apache License 2.0 | 4 votes |
FilteredModuleFactory(ModuleFactory moduleFactory, Set<String> excludes) { this.moduleFactory = moduleFactory; this.excludes = excludes; }
Example #7
Source File: SpringConfigurationLoader.java From spring-javaformat with Apache License 2.0 | 4 votes |
SpringConfigurationLoader(Context context, ModuleFactory moduleFactory) { this.context = context; this.moduleFactory = moduleFactory; }
Example #8
Source File: ClassFileSetCheck.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
/** * Sets the module factory for creating child modules (Checks). * @param aModuleFactory the factory */ public void setModuleFactory(ModuleFactory aModuleFactory) { mModuleFactory = aModuleFactory; }
Example #9
Source File: ClassFileSetCheck.java From contribution with GNU Lesser General Public License v2.1 | 4 votes |
/** * Sets the module factory for creating child modules (Checks). * @param aModuleFactory the factory */ public void setModuleFactory(ModuleFactory aModuleFactory) { mModuleFactory = aModuleFactory; }
Example #10
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 #11
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); }
Example #12
Source File: SpringChecks.java From spring-javaformat with Apache License 2.0 | 2 votes |
/** * Sets the module factory for creating child modules (Checks). * @param moduleFactory the factory */ public void setModuleFactory(ModuleFactory moduleFactory) { this.moduleFactory = moduleFactory; }