public static class Param.Builder extends Object
| 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 char |
GREATER |
static String |
ISEMPTY |
static String |
ISNOTEMPTY |
static String |
ISNOTNULL |
static String |
ISNULL |
static char |
NEGATION |
static char |
SMALLER |
| 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 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 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 using the 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.
|
void |
addParam(List<Param> p) |
List<Param> |
build()
usefull if for example you need to add parameters yielded by a diffently configured builder
|
boolean |
containsKey(String key) |
boolean |
isGreaterThan(String value)
check if a string (user value) indicates a greater than comparison when syntaxInValue
is used
|
boolean |
isNegation(String value)
check if a string (user value) indicates a negation when syntaxInValue
is used
|
boolean |
isSmallerThan(String value)
check if a string (user value) indicates a smaller than comparison when syntaxInValue
is used
|
boolean |
isSyntaxInValue()
when true wildcards are not replaced and syntax in value is not
applied
|
String |
operator(String operator,
String value,
boolean syntaxInValue)
Returns an operator from the value when syntax is used and the
trimmed value equals one of the supported operators, otherwise the
trimmed operator
|
Param.Builder |
remove(String paramKey) |
static boolean |
valueIsOperator(String s,
boolean syntaxInValue)
users may input "(!)is null", "(!)is empty", 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 static final char GREATER
public static final char SMALLER
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 static boolean valueIsOperator(String s, boolean syntaxInValue)
s - syntaxInValue - 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(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 - 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 add(String propertyPath, String paramKey, String operator, Object paramValue, boolean not, boolean or)
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 - IllegalArgumentException - when paramKey is already present or
when value is nullpublic Param.Builder remove(String paramKey)
public boolean isNegation(String value)
value - NEGATIONpublic boolean isGreaterThan(String value)
value - GREATERpublic boolean isSmallerThan(String value)
value - SMALLERpublic String operator(String operator, String value, boolean syntaxInValue)
operator - value - syntaxInValue - public List<Param> build()
public boolean isSyntaxInValue()
public boolean containsKey(String key)
Copyright © 2018–2019 Fryske Akademy. All rights reserved.