当前位置: 首页>>代码示例>>Java>>正文


Java CommonUtils.createPattern方法代码示例

本文整理汇总了Java中com.puppycrawl.tools.checkstyle.utils.CommonUtils.createPattern方法的典型用法代码示例。如果您正苦于以下问题:Java CommonUtils.createPattern方法的具体用法?Java CommonUtils.createPattern怎么用?Java CommonUtils.createPattern使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.puppycrawl.tools.checkstyle.utils.CommonUtils的用法示例。


在下文中一共展示了CommonUtils.createPattern方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: XpathFilter

import com.puppycrawl.tools.checkstyle.utils.CommonUtils; //导入方法依赖的package包/类
/**
 * Creates a {@code XpathElement} instance.
 * @param files regular expression for names of filtered files
 * @param checks regular expression for filtered check classes
 * @param message regular expression for messages.
 * @param moduleId the module id
 * @param query the xpath query
 */
public XpathFilter(String files, String checks,
                   String message, String moduleId, String query) {
    filePattern = files;
    if (files == null) {
        fileRegexp = null;
    }
    else {
        fileRegexp = Pattern.compile(files);
    }
    checkPattern = checks;
    if (checks == null) {
        checkRegexp = null;
    }
    else {
        checkRegexp = CommonUtils.createPattern(checks);
    }
    messagePattern = message;
    if (message == null) {
        messageRegexp = null;
    }
    else {
        messageRegexp = Pattern.compile(message);
    }
    this.moduleId = moduleId;
    xpathQuery = query;
    if (xpathQuery == null) {
        xpathExpression = null;
    }
    else {
        final XPathEvaluator xpathEvaluator = new XPathEvaluator();
        try {
            xpathExpression = xpathEvaluator.createExpression(xpathQuery);
        }
        catch (XPathException ex) {
            throw new IllegalStateException("Unexpected xpath query: " + xpathQuery, ex);
        }
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:47,代码来源:XpathFilter.java

示例2: TranslationCheck

import com.puppycrawl.tools.checkstyle.utils.CommonUtils; //导入方法依赖的package包/类
/**
 * Creates a new {@code TranslationCheck} instance.
 */
public TranslationCheck() {
    setFileExtensions("properties");
    baseName = CommonUtils.createPattern("^messages.*$");
    log = LogFactory.getLog(TranslationCheck.class);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:9,代码来源:TranslationCheck.java

示例3: setTag

import com.puppycrawl.tools.checkstyle.utils.CommonUtils; //导入方法依赖的package包/类
/**
 * Sets the tag to check.
 * @param tag tag to check
 */
public void setTag(String tag) {
    this.tag = tag;
    tagRegExp = CommonUtils.createPattern(tag + "\\s*(.*$)");
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:9,代码来源:WriteTagCheck.java

示例4: init

import com.puppycrawl.tools.checkstyle.utils.CommonUtils; //导入方法依赖的package包/类
@Override
public void init() {
    if (fileNamePattern == null && folderPattern == null) {
        fileNamePattern = CommonUtils.createPattern("\\s");
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:7,代码来源:RegexpOnFilenameCheck.java

示例5: convert

import com.puppycrawl.tools.checkstyle.utils.CommonUtils; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public Object convert(Class type, Object value) {
    return CommonUtils.createPattern(value.toString());
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:6,代码来源:AutomaticBean.java

示例6: updateRegexp

import com.puppycrawl.tools.checkstyle.utils.CommonUtils; //导入方法依赖的package包/类
/**
 * Updates the {@link #regexp} based on the values from {@link #format} and
 * {@link #compileFlags}.
 */
private void updateRegexp() {
    regexp = CommonUtils.createPattern(format, compileFlags);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:8,代码来源:IllegalTokenTextCheck.java

示例7: AbstractNameCheck

import com.puppycrawl.tools.checkstyle.utils.CommonUtils; //导入方法依赖的package包/类
/**
 * Creates a new {@code AbstractNameCheck} instance.
 * @param format format to check with
 */
protected AbstractNameCheck(String format) {
    this.format = CommonUtils.createPattern(format);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:8,代码来源:AbstractNameCheck.java

示例8: setExceptionVariableName

import com.puppycrawl.tools.checkstyle.utils.CommonUtils; //导入方法依赖的package包/类
/**
 * Setter for exception's variable name format.
 * @param exceptionVariableName
 *        format of exception's variable name.
 * @throws org.apache.commons.beanutils.ConversionException
 *         if unable to create Pattern object.
 */
public void setExceptionVariableName(String exceptionVariableName) {
    this.exceptionVariableName = exceptionVariableName;
    variableNameRegexp = CommonUtils.createPattern(exceptionVariableName);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:12,代码来源:EmptyCatchBlockCheck.java

示例9: setCommentFormat

import com.puppycrawl.tools.checkstyle.utils.CommonUtils; //导入方法依赖的package包/类
/**
 * Setter for comment format.
 * @param commentFormat
 *        format of comment.
 * @throws org.apache.commons.beanutils.ConversionException
 *         if unable to create Pattern object.
 */
public void setCommentFormat(String commentFormat) {
    this.commentFormat = commentFormat;
    commentRegexp = CommonUtils.createPattern(commentFormat);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:12,代码来源:EmptyCatchBlockCheck.java

示例10: setFormat

import com.puppycrawl.tools.checkstyle.utils.CommonUtils; //导入方法依赖的package包/类
/**
 * Set the format to the specified regular expression.
 * @param pattern the new pattern
 * @throws org.apache.commons.beanutils.ConversionException unable to parse format
 */
public final void setFormat(Pattern pattern) {
    format = CommonUtils.createPattern(pattern.pattern(), Pattern.MULTILINE);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:9,代码来源:RegexpCheck.java

示例11: setClassNameFormat

import com.puppycrawl.tools.checkstyle.utils.CommonUtils; //导入方法依赖的package包/类
/**
 * Set the format to the specified regular expression.
 *
 * @param format a {@code String} value
 */
public void setClassNameFormat(String format) {
  this.classNameFormat = format;
  regexp = CommonUtils.createPattern(format);
}
 
开发者ID:startupheroes,项目名称:startupheroes-checkstyle,代码行数:10,代码来源:LogDataTableCheck.java


注:本文中的com.puppycrawl.tools.checkstyle.utils.CommonUtils.createPattern方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。