Java源码示例:com.puppycrawl.tools.checkstyle.ModuleFactory

示例1
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;
}
 
示例2
@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));
}
 
示例3
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);
	}
}
 
示例4
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;
}
 
示例5
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;
}
 
示例6
FilteredModuleFactory(ModuleFactory moduleFactory, Set<String> excludes) {
	this.moduleFactory = moduleFactory;
	this.excludes = excludes;
}
 
示例7
SpringConfigurationLoader(Context context, ModuleFactory moduleFactory) {
	this.context = context;
	this.moduleFactory = moduleFactory;
}
 
示例8
/**
 * Sets the module factory for creating child modules (Checks).
 * @param aModuleFactory the factory
 */
public void setModuleFactory(ModuleFactory aModuleFactory)
{
    mModuleFactory = aModuleFactory;
}
 
示例9
/**
 * Sets the module factory for creating child modules (Checks).
 * @param aModuleFactory the factory
 */
public void setModuleFactory(ModuleFactory aModuleFactory)
{
    mModuleFactory = aModuleFactory;
}
 
示例10
private RootModule getRootModule(String name, ClassLoader moduleClassLoader) throws CheckstyleException {
	ModuleFactory factory = new PackageObjectFactory(Checker.class.getPackage().getName() + ".", moduleClassLoader);
	return (RootModule) factory.createModule(name);
}
 
示例11
/**
 * 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);
}
 
示例12
/**
 * Sets the module factory for creating child modules (Checks).
 * @param moduleFactory the factory
 */
public void setModuleFactory(ModuleFactory moduleFactory) {
	this.moduleFactory = moduleFactory;
}