本文整理汇总了Java中com.puppycrawl.tools.checkstyle.PackageNamesLoader类的典型用法代码示例。如果您正苦于以下问题:Java PackageNamesLoader类的具体用法?Java PackageNamesLoader怎么用?Java PackageNamesLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PackageNamesLoader类属于com.puppycrawl.tools.checkstyle包,在下文中一共展示了PackageNamesLoader类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.puppycrawl.tools.checkstyle.PackageNamesLoader; //导入依赖的package包/类
/**
* Execute Checkstyle and return the generated XML report.
* @noinspection TooBroadScope
*/
public void execute() {
final Locale initialLocale = Locale.getDefault();
Locale.setDefault(Locale.ENGLISH);
final ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(PackageNamesLoader.class.getClassLoader());
final URLClassLoader projectClassloader = createClassloader();
try {
executeWithClassLoader(projectClassloader);
}
finally {
Thread.currentThread().setContextClassLoader(initialClassLoader);
Locale.setDefault(initialLocale);
close(projectClassloader);
}
}
示例2: getPackageObjectFactory
import com.puppycrawl.tools.checkstyle.PackageNamesLoader; //导入依赖的package包/类
/**
* Returns the default PackageObjectFactory with the default package names.
* @return the default PackageObjectFactory.
*/
public static PackageObjectFactory getPackageObjectFactory() throws CheckstyleException {
final ClassLoader cl = TestUtil.class.getClassLoader();
final Set<String> packageNames = PackageNamesLoader.getPackageNames(cl);
return new PackageObjectFactory(packageNames, cl);
}