本文整理了Java中org.eclipse.persistence.internal.helper.Helper.convertLikeToRegex()
方法的一些代码示例,展示了Helper.convertLikeToRegex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.convertLikeToRegex()
方法的具体详情如下:
包路径:org.eclipse.persistence.internal.helper.Helper
类名称:Helper
方法名:convertLikeToRegex
[英]Convert the SQL like pattern to a regex pattern.
[中]将类似SQL的模式转换为正则表达式模式。
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* INTERNAL:
* An implementation of in memory queries with Like which uses the
* regular expression framework.
*/
public static Boolean conformLike(Object left, Object right) {
if ((left == null) && (right == null)) {
return Boolean.TRUE;
} else if ((left == null) || (right == null)) {
return Boolean.FALSE;
}
left = String.valueOf(left);
right = String.valueOf(right);
// PERF: First check the pattern cache for the pattern.
// Note that the original string is the key, to avoid having to translate it first.
Pattern pattern = (Pattern)patternCache.get(right);
if (pattern == null) {
// Bug 3936427 - Replace regular expression reserved characters with escaped version of those characters
// For instance replace ? with \?
String convertedRight = Helper.convertLikeToRegex((String)right);
pattern = Pattern.compile(convertedRight);
// Ensure cache does not grow beyond 100.
if (patternCache.size() > 100) {
patternCache.remove(patternCache.keySet().iterator().next());
}
patternCache.put(right, pattern);
}
return pattern.matcher((String)left).matches();
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
String convertedRight = Helper.convertLikeToRegex((String)right);
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.nosql
DatabaseRecord nested = new DatabaseRecord();
if (!this.isLikeRegex) {
pattern = Helper.convertLikeToRegex(pattern);
内容来源于网络,如有侵权,请联系作者删除!