public class Like extends Object
This can be used to generate queries like x LIKE 'a%'
. Using the helper methods this can also be used to
search for occurrences of serveral words in several fields, this can be used as a general table search.
Modifier and Type | Method and Description |
---|---|
SQLConstraint |
build()
Generates a constraint for the given settings
|
Like |
contains(String value)
Sepcifies a value which needs to occur anywhere in the target field.
|
Like |
ignoreCase()
Specifies that upper- and lowercase should not be distinguished.
|
Like |
ignoreEmpty()
Permits to skip this constraint if the given filter value is empty.
|
Like |
matches(String value)
Specifies a value to match in the given field.
|
Like |
startsWith(String value)
Sepcifies a value with which the target field needs to start.
|
protected Like(Mapping field)
public Like matches(String value)
Note that "*" will be repalced by "%" as this is the wildcard used by SQL.
value
- the text to search forpublic Like contains(String value)
This is roughly the same as calling matches("*"+value+"*")
.
value
- the value to search forpublic Like startsWith(String value)
This is roughly the same as calling matches(value+"*")
.
value
- the value to search forpublic Like ignoreCase()
public Like ignoreEmpty()
@Nullable public SQLConstraint build()
Copyright © 2018. All rights reserved.