public static class Param.Builder extends Object
StringConverter has some ready to
use converters| Modifier and Type | Class and Description |
|---|---|
static class |
Param.Builder.DefaultWildcardMapping
* => %, ? => _, NOTE that this mapping causes all four
characters to be interpreted as wildcards in jpql/sql.
|
static interface |
Param.Builder.WildcardMapping
translation table a wildcard for more characters and a wildcard for
one character
|
| Modifier and Type | Field and Description |
|---|---|
static Param.Builder.WildcardMapping |
DEFAULT_MAPPING |
static String |
ISEMPTY |
static String |
ISNOTEMPTY |
static String |
ISNOTNULL |
static String |
ISNULL |
static char |
NEGATION |
| Constructor and Description |
|---|
Builder()
Builder with syntax support in value (!, is [not] null, is [not]
empty).
|
Builder(boolean caseInsensitive)
Calls
#Builder(boolean, WildcardMapping, boolean)
} with true, null and the caseInsensitive argument. |
Builder(boolean syntaxInValue,
Param.Builder.WildcardMapping wildcardMapping,
boolean caseInsensitive) |
| Modifier and Type | Method and Description |
|---|---|
Param.Builder |
add(String paramKey,
Object paramValue)
This method is suitable when your paramValue is the correct object
for the query to be executed.
|
Param.Builder |
add(String paramKey,
Object paramValue,
boolean or)
This method is suitable when your paramValue is the correct object
for the query to be executed.
|
Param.Builder |
add(String paramKey,
String paramValue,
boolean or,
com.vectorprint.StringConverter converter)
This method is suitable when your paramValue is a String that must be
converted to get the correct object for the query to be executed.
|
Param.Builder |
add(String paramKey,
String paramValue,
String operator,
boolean or,
com.vectorprint.StringConverter converter)
Assumes key and propertyPath are the same
|
Param.Builder |
add(String paramKey,
String paramValue,
com.vectorprint.StringConverter converter)
This method is suitable when your paramValue is a String that must be
converted to get the correct object for the query to be executed.
|
Param.Builder |
add(String propertyPath,
String paramKey,
String operator,
Object paramValue,
boolean not,
boolean or)
Bottleneck method, adds a new Param, does not apply any intelligence.
|
Param.Builder |
add(String propertyPath,
String paramKey,
String operator,
String paramValue,
boolean or,
com.vectorprint.StringConverter converter)
Bottleneck method for String values, when configured in the Builder,
applies syntax support and wildcard mapping, applies conversion of
the String value.
|
Param.Builder |
add(String paramKey,
String paramValue,
String operator,
com.vectorprint.StringConverter converter)
Uses true for "or"
|
List<Param> |
build() |
boolean |
containsKey(String key) |
boolean |
isNegation(String value)
check if a string (user value) indicates a negation and syntaxInValue
is used
|
boolean |
isSyntaxInValue()
when true wildcards are not replaced and syntax in value is not applied
|
static String |
operator(String operator,
String value,
boolean syntaxInValue)
Returns static final Strings when syntax is used and present in
value, otherwise the trimmed operator
|
Param.Builder |
remove(String paramKey) |
static boolean |
valueIsOperator(String s,
boolean syntaxInValue)
users may input "is (not) null", "is (not) empty" etc., in that case
there is no parameter value to be set for a key.
|
public static final Param.Builder.WildcardMapping DEFAULT_MAPPING
public static final String ISNULL
public static final String ISNOTNULL
public static final String ISEMPTY
public static final String ISNOTEMPTY
public static final char NEGATION
public Builder(boolean syntaxInValue,
Param.Builder.WildcardMapping wildcardMapping,
boolean caseInsensitive)
public Builder()
#Builder(boolean, WildcardMapping, boolean)
with true, null and false.public Builder(boolean caseInsensitive)
#Builder(boolean, WildcardMapping, boolean)
} with true, null and the caseInsensitive argument.caseInsensitive - public Param.Builder add(String paramKey, Object paramValue)
paramKey - paramValue - public Param.Builder add(String paramKey, Object paramValue, boolean or)
paramKey - paramValue - or - will be prepended in the query for parameters except the
firstpublic Param.Builder add(String paramKey, String paramValue, com.vectorprint.StringConverter converter)
paramKey - paramValue - converter - see StringConverterpublic Param.Builder add(String paramKey, String paramValue, String operator, com.vectorprint.StringConverter converter)
paramKey - paramValue - operator - converter - public Param.Builder add(String paramKey, String paramValue, boolean or, com.vectorprint.StringConverter converter)
paramKey - paramValue - or - converter - see StringConverterpublic Param.Builder add(String paramKey, String paramValue, String operator, boolean or, com.vectorprint.StringConverter converter)
paramKey - paramValue - operator - or - converter - public Param.Builder add(String propertyPath, String paramKey, String operator, String paramValue, boolean or, com.vectorprint.StringConverter converter)
add(java.lang.String, java.lang.String, java.lang.String, java.lang.Object, boolean, boolean)
with operator(java.lang.String, java.lang.String, boolean)
for the operator. The value will be the empty string when valueIsOperator(java.lang.String, boolean) is true, will be StringConverter.convert(java.lang.String)
when a converter is provided (negation is stripped), otherwise the
value is returned with wildcards replaced and negation stripped
(provided syntax support in values is active).propertyPath - paramKey - operator - paramValue - or - converter - see StringConverterpublic Param.Builder add(String propertyPath, String paramKey, String operator, Object paramValue, boolean not, boolean or)
propertyPath - paramKey - operator - paramValue - not - or - IllegalArgumentException - when paramKey is already present or
when value is nullpublic Param.Builder remove(String paramKey)
public boolean isNegation(String value)
value - NEGATIONpublic static String operator(String operator, String value, boolean syntaxInValue)
operator - value - syntaxInValue - public static boolean valueIsOperator(String s, boolean syntaxInValue)
s - syntaxInValue - public boolean isSyntaxInValue()
public boolean containsKey(String key)
Copyright © 2018 Fryske Akademy. All rights reserved.