本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.Configuration.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.getName方法的具体用法?Java Configuration.getName怎么用?Java Configuration.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.puppycrawl.tools.checkstyle.api.Configuration
的用法示例。
在下文中一共展示了Configuration.getName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupChild
import com.puppycrawl.tools.checkstyle.api.Configuration; //导入方法依赖的package包/类
/**
* Instantiates, configures and registers a Check that is specified
* in the provided configuration.
* @see com.puppycrawl.tools.checkstyle.api.AutomaticBean
*/
public void setupChild(Configuration aChildConf)
throws CheckstyleException
{
// TODO: improve the error handing
final String name = aChildConf.getName();
final Object module = mModuleFactory.createModule(name);
if (!(module instanceof AbstractCheckVisitor)) {
throw new CheckstyleException(
"ClassFileSet is not allowed as a parent of " + name);
}
final AbstractCheckVisitor c = (AbstractCheckVisitor) module;
c.contextualize(mChildContext);
c.configure(aChildConf);
c.init();
registerCheck(c);
}
示例2: createChecker
import com.puppycrawl.tools.checkstyle.api.Configuration; //导入方法依赖的package包/类
/**
* Creates {@link Checker} instance based on the given {@link Configuration} instance.
* @param moduleConfig {@link Configuration} instance.
* @return {@link Checker} instance based on the given {@link Configuration} instance.
* @throws Exception if an exception occurs during checker configuration.
*/
public final Checker createChecker(Configuration moduleConfig)
throws Exception {
if (checkstyleModules == null) {
checkstyleModules = CheckUtil.getCheckstyleModules();
}
final String name = moduleConfig.getName();
ModuleCreationOption moduleCreationOption = ModuleCreationOption.IN_CHECKER;
for (Class<?> moduleClass : checkstyleModules) {
if (moduleClass.getSimpleName().equals(name)
|| moduleClass.getSimpleName().equals(name + "Check")) {
if (ModuleReflectionUtils.isCheckstyleTreeWalkerCheck(moduleClass)
|| ModuleReflectionUtils.isTreeWalkerFilterModule(moduleClass)) {
moduleCreationOption = ModuleCreationOption.IN_TREEWALKER;
}
break;
}
}
return createChecker(moduleConfig, moduleCreationOption);
}
示例3: createChecker
import com.puppycrawl.tools.checkstyle.api.Configuration; //导入方法依赖的package包/类
/**
* Creates {@link Checker} instance based on the given {@link Configuration} instance.
* @param moduleConfig {@link Configuration} instance.
* @return {@link Checker} instance based on the given {@link Configuration} instance.
* @throws Exception if an exception occurs during checker configuration.
*/
public final Checker createChecker(Configuration moduleConfig)
throws Exception {
ModuleCreationOption moduleCreationOption = ModuleCreationOption.IN_CHECKER;
final String moduleName = moduleConfig.getName();
if (!ROOT_MODULE_NAME.equals(moduleName)) {
try {
final Class<?> moduleClass = Class.forName(moduleName);
if (ModuleReflectionUtils.isCheckstyleTreeWalkerCheck(moduleClass)
|| ModuleReflectionUtils.isTreeWalkerFilterModule(moduleClass)) {
moduleCreationOption = ModuleCreationOption.IN_TREEWALKER;
}
}
catch (ClassNotFoundException ignore) {
// ignore exception, assume it is not part of TreeWalker
}
}
return createChecker(moduleConfig, moduleCreationOption);
}
示例4: endElement
import com.puppycrawl.tools.checkstyle.api.Configuration; //导入方法依赖的package包/类
@Override
public void endElement(String uri,
String localName,
String qName) throws SAXException {
if (qName.equals(MODULE)) {
final Configuration recentModule =
configStack.pop();
// get severity attribute if it exists
SeverityLevel level = null;
if (containsAttribute(recentModule, SEVERITY)) {
try {
final String severity = recentModule.getAttribute(SEVERITY);
level = SeverityLevel.getInstance(severity);
}
catch (final CheckstyleException ex) {
// [email protected][IllegalInstantiation] SAXException is in the overridden
// method signature
throw new SAXException(
"Problem during accessing '" + SEVERITY + "' attribute for "
+ recentModule.getName(), ex);
}
}
// omit this module if these should be omitted and the module
// has the severity 'ignore'
final boolean omitModule = omitIgnoredModules
&& level == SeverityLevel.IGNORE;
if (omitModule && !configStack.isEmpty()) {
final DefaultConfiguration parentModule =
configStack.peek();
parentModule.removeChild(recentModule);
}
}
}
示例5: setupChild
import com.puppycrawl.tools.checkstyle.api.Configuration; //导入方法依赖的package包/类
/**
* {@inheritDoc} Creates child module.
* @noinspection ChainOfInstanceofChecks
*/
@Override
public void setupChild(Configuration childConf)
throws CheckstyleException {
final String name = childConf.getName();
final Object module = moduleFactory.createModule(name);
if (module instanceof AutomaticBean) {
final AutomaticBean bean = (AutomaticBean) module;
bean.contextualize(childContext);
bean.configure(childConf);
}
if (module instanceof AbstractCheck) {
final AbstractCheck check = (AbstractCheck) module;
check.init();
registerCheck(check);
}
else if (module instanceof TreeWalkerFilter) {
final TreeWalkerFilter filter = (TreeWalkerFilter) module;
filters.add(filter);
}
else {
throw new CheckstyleException(
"TreeWalker is not allowed as a parent of " + name
+ " Please review 'Parent Module' section for this Check in web"
+ " documentation if Check is standard.");
}
}