public enum LikePatternSyntax extends Enum<LikePatternSyntax>
SQL
syntax, human user expect GLOB
syntax in search forms. Therefore this enum also supports
conversion
from one syntax to another.Enum Constant and Description |
---|
GLOB
Glob syntax that is typically expected by end-users and supported by typical search forms.
|
SQL
SQL syntax that is typically required by databases.
|
Modifier and Type | Field and Description |
---|---|
private char |
any |
static char |
ESCAPE
The escape character.
|
private char |
single |
Modifier and Type | Method and Description |
---|---|
static LikePatternSyntax |
autoDetect(String pattern) |
String |
convert(String pattern,
LikePatternSyntax syntax) |
String |
convert(String pattern,
LikePatternSyntax syntax,
boolean matchSubstring) |
char |
getAny() |
char |
getSingle() |
static LikePatternSyntax |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static LikePatternSyntax[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final LikePatternSyntax GLOB
any wildcard
and question-mark ('?') for single wildcard
.public static final LikePatternSyntax SQL
any wildcard
and
underscore ('_') for single wildcard
.public static final char ESCAPE
private final char any
private final char single
public static LikePatternSyntax[] values()
for (LikePatternSyntax c : LikePatternSyntax.values()) System.out.println(c);
public static LikePatternSyntax valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic char getAny()
empty
string.public char getSingle()
public String convert(String pattern, LikePatternSyntax syntax)
pattern
- the LIKE pattern in the given LikePatternSyntax
.syntax
- the LikePatternSyntax
of the given pattern
.pattern
converted to this LikePatternSyntax
.public String convert(String pattern, LikePatternSyntax syntax, boolean matchSubstring)
pattern
- the LIKE pattern in the given LikePatternSyntax
.syntax
- the LikePatternSyntax
of the given pattern
.matchSubstring
- - true
if the given pattern
shall also match substrings, false
otherwise.pattern
converted to this LikePatternSyntax
.public static LikePatternSyntax autoDetect(String pattern)
pattern
- the string value that may be a pattern.LikePatternSyntax
for the given pattern
or null
if the given pattern
does not contain any wildcards.Copyright © 2014–2019 devon4j-Team. All rights reserved.