public static class Param.Builder extends Object
Users may use syntax in values they submit (comparisons must be at the start):
| 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 for wildcards
|
| Modifier and Type | Field and Description |
|---|---|
static Param.Builder.WildcardMapping |
DEFAULT_MAPPING |
| Constructor and Description |
|---|
Builder()
Builder with syntax support in value (!, >[=], <[=], [!]is null,
[!]is empty, [!]is blank).
|
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 propertyPath,
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 propertyPath,
String paramKey,
OPERATOR operator,
Object paramValue,
boolean not,
boolean or)
Calls
add(String, String, OPERATOR, Object, boolean, boolean, Object)
with null for maxValue |
Param.Builder |
add(String propertyPath,
String paramKey,
OPERATOR operator,
Object paramValue,
boolean not,
boolean or,
Object maxValue)
Bottleneck method, adds a new Param, does not apply any intelligence.
|
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)
Calls
add(String, String, String, Object, boolean, boolean, Object)
with null for maxValue |
Param.Builder |
add(String propertyPath,
String paramKey,
String operator,
Object paramValue,
boolean not,
boolean or,
Object maxValue)
|
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 using the optinally supplied converter.
|
Param.Builder |
add(String propertyPath,
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 |
addParam(List<Param> p) |
Param.Builder |
addParam(Param... p) |
List<Param> |
build()
usefull if for example you need to add parameters yielded by a
diffently configured builder
|
Param.Builder |
checkNotNull(String propertyPath) |
Param.Builder |
clear() |
boolean |
containsKey(String key) |
boolean |
isNegation(String value)
check if a string (user value) indicates a negation when
syntaxInValue is used
|
boolean |
isSyntaxInValue()
when true wildcards are not replaced and syntax in value is not
applied
|
Param.Builder |
remove(String paramKey) |
Param.Builder |
setGroupEndsLastParam(int group)
how many groups does the last parameter end, ")";
|
Param.Builder |
setGroupEndsParam(int group,
int paramIndex) |
Param.Builder |
setGroupEndsParam(int group,
String key) |
Param.Builder |
setGroupStartsLastParam(int group)
how many groups does the last parameter start, "(";
|
Param.Builder |
setGroupStartsParam(int group,
int paramIndex) |
Param.Builder |
setGroupStartsParam(int group,
String key) |
public static final Param.Builder.WildcardMapping DEFAULT_MAPPING
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 to parameters in the query except the
firstpublic Param.Builder add(String propertyPath, String paramKey, Object paramValue, boolean or)
propertyPath - paramKey - paramValue - or - will be prepended to parameters in the query except the
firstpublic Param.Builder add(String paramKey, String paramValue, com.vectorprint.StringConverter converter)
paramKey - paramValue - converter - see StringConverterpublic Param.Builder add(String propertyPath, String paramKey, String paramValue, com.vectorprint.StringConverter converter)
propertyPath - paramKey - paramValue - converter - see StringConverterpublic 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(String, String, OPERATOR, Object, boolean, boolean, Object)
}
with OPERATOR.operator(String, String, boolean)
for the operator. The value will be the empty string when OPERATOR.valueIsOperator(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 - The propertyPath may differ from key allowing you
to apply multiple comparisons for the same propertyPath (i.e.
e.column1=:column1 or e.column1=:column2).paramKey - operator - paramValue - or - converter - see StringConverterpublic Param.Builder checkNotNull(String propertyPath)
public Param.Builder setGroupStartsLastParam(int group)
public Param.Builder setGroupStartsParam(int group, String key)
public Param.Builder setGroupStartsParam(int group, int paramIndex)
public Param.Builder setGroupEndsLastParam(int group)
public Param.Builder setGroupEndsParam(int group, int paramIndex)
public Param.Builder setGroupEndsParam(int group, String key)
public Param.Builder add(String propertyPath, String paramKey, OPERATOR operator, Object paramValue, boolean not, boolean or, Object maxValue)
propertyPath - The propertyPath may differ from key allowing you
to apply multiple comparisons for the same propertyPath (i.e.
e.column1=:column1 or e.column1=:column2).paramKey - operator - paramValue - not - or - maxValue - for OPERATOR.BETWEENIllegalArgumentException - when paramKey is already present,
value is null or invalid BETWEEN valuespublic Param.Builder add(String propertyPath, String paramKey, OPERATOR operator, Object paramValue, boolean not, boolean or)
add(String, String, OPERATOR, Object, boolean, boolean, Object)
with null for maxValuepropertyPath - paramKey - operator - paramValue - not - or - public Param.Builder add(String propertyPath, String paramKey, String operator, Object paramValue, boolean not, boolean or, Object maxValue)
add(String, String, OPERATOR, Object, boolean, boolean, Object)
with OPERATOR.fromToken(String)propertyPath - paramKey - operator - paramValue - not - or - maxValue - for OPERATOR.BETWEENpublic Param.Builder add(String propertyPath, String paramKey, String operator, Object paramValue, boolean not, boolean or)
add(String, String, String, Object, boolean, boolean, Object)
with null for maxValuepropertyPath - paramKey - operator - paramValue - not - or - public Param.Builder remove(String paramKey)
public Param.Builder clear()
public boolean isNegation(String value)
value - OPERATOR.negation(String)public Param.Builder addParam(List<Param> p)
public Param.Builder addParam(Param... p)
public List<Param> build()
public boolean isSyntaxInValue()
public boolean containsKey(String key)
Copyright © 2018–2021 Fryske Akademy. All rights reserved.