public static class Param.Builder extends Object
Users may use syntax in values they submit:
| 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 String |
BETWEENPATTERN |
static Param.Builder.WildcardMapping |
DEFAULT_MAPPING |
static char |
GREATER |
static String |
ISBLANK |
static String |
ISEMPTY
for empty collection!
|
static String |
ISNOTBLANK |
static String |
ISNOTEMPTY
for non empty collection!
|
static String |
ISNOTNULL |
static String |
ISNULL |
static char |
NEGATION |
static char |
SMALLER |
| Constructor and Description |
|---|
Builder()
Builder with syntax support in value (!, >, < [!]is null, [!]is
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 propertyPath,
String paramKey,
Param.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,
Param.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)
Calls
#add(String, String, OPERATOR, Object, boolean, boolean, Object) with Param.OPERATOR.fromToken(String) |
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.
|
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) |
boolean |
containsKey(String key) |
static boolean |
greater(String value)
check if a string (user value) indicates a greater than comparison
|
static boolean |
isBetween(String value) |
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
|
Param.Builder |
lastParamEndsGroup(boolean group) |
Param.Builder |
lastParamStartsGroup(boolean group) |
static boolean |
negation(String value)
check if a string (user value) indicates a negation
|
Param.OPERATOR |
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 |
smaller(String value)
check if a string (user value) indicates a smaller than comparison
|
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 and the negation is in the operator ("is not null" as opposed to "not >")
|
public static final Param.Builder.WildcardMapping DEFAULT_MAPPING
public static final char NEGATION
public static final String ISNULL
public static final String ISNOTNULL
public static final String ISBLANK
public static final String ISNOTBLANK
public static final String ISEMPTY
public static final String ISNOTEMPTY
public static final char GREATER
public static final char SMALLER
public static final String BETWEENPATTERN
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(String, String, OPERATOR, Object, boolean, boolean, Object)
}
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 checkNotNull(String propertyPath)
public Param.Builder lastParamStartsGroup(boolean group)
group - when true the last parameter starts a group (.public Param.Builder lastParamEndsGroup(boolean group)
group - when true the last parameter starts a group (.public static boolean isBetween(String value)
public Param.Builder add(String propertyPath, String paramKey, Param.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 Param.OPERATOR.BETWEENIllegalArgumentException - when paramKey is already present, value is null or invalid BETWEEN valuespublic Param.Builder add(String propertyPath, String paramKey, Param.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 Param.OPERATOR.fromToken(String)propertyPath - paramKey - operator - paramValue - not - or - maxValue - for Param.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 boolean isNegation(String value)
value - NEGATIONpublic static boolean negation(String value)
value - NEGATIONpublic static boolean greater(String value)
value - GREATERpublic static boolean smaller(String value)
value - SMALLERpublic boolean isGreaterThan(String value)
value - GREATERpublic boolean isSmallerThan(String value)
value - SMALLERpublic Param.OPERATOR operator(String operator, String value, boolean syntaxInValue)
operator - value - syntaxInValue - 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–2020 Fryske Akademy. All rights reserved.