本文整理汇总了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);
}
}
}
示例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);
}
示例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*(.*$)");
}
示例4: init
import com.puppycrawl.tools.checkstyle.utils.CommonUtils; //导入方法依赖的package包/类
@Override
public void init() {
if (fileNamePattern == null && folderPattern == null) {
fileNamePattern = CommonUtils.createPattern("\\s");
}
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}