P - type of Path, example - StringPath
or EnumPath.V - type of value for path. Depending on type of path, this could be a collection of String or else
Collection of String or String or Enum or Collection of Enum. This must not be wrapped in Optional.public interface ExpressionProvider<P extends com.querydsl.core.types.Path,V>
Predicate or BooleanExpression to be used to pass to
QueryDSL for querying underlying store.
This interface and entire component of QueryDSL extension is to build on top of Spring data QueryDSL extensions for QueryDSL by providing further low level of search operators within values which is a powerful extension by empowering client application to perform variety searches, an improvement over largely static capability out of the box to statically define different binding using QuerydslBinderCustomizer.
With this extension, client's can request in a variety of forms like below:Interface also defines supported operators though specific implementation may only support a subset of them so must be checked on implementation on supported Operators to avoid unpredictable errors in search logic/processing. Implementation must support all Logical Operators.
Operator,
Spring data Querydsl Extensions,
QuerydslBinderCustomizer| Modifier and Type | Field and Description |
|---|---|
static String |
OPERATOR_VALUE_DELIMITER_PREFIX
Provides a operator value delimiter prefix for when explicit delimiter is provided.
|
static String |
OPERATOR_VALUE_DELIMITER_SUFFIX
Provides a operator value delimiter suffix for when explicit delimiter is provided.
|
| Modifier and Type | Method and Description |
|---|---|
default Optional<com.querydsl.core.types.dsl.BooleanExpression> |
getExpression(P path,
V value)
Method establishes the contract to retrieve a
BooleanExpression based on implementation specific
logic's processing of supplied value(s). |
default Optional<com.querydsl.core.types.Predicate> |
getPredicate(P path,
V value)
Method establishes contract to retrieve a predicate based on implementation specific logic's processing of
supplied value(s).
|
static <S extends String> |
isOperator(Operator[] operators,
S value)
Utility function to check if provided value starts with an Operator.
|
static boolean |
isOperator(Operator operator,
String value)
Returns
true if provided value is wrapped in supplied operator |
static <S extends String> |
isOperator(S value)
Utility function to check if provided value starts with an Operator.
|
static void |
validateComposition(String value)
Utility method which validates proper ordering and opening/closing delimiters of operators on supplied
value |
static final String OPERATOR_VALUE_DELIMITER_PREFIX
static final String OPERATOR_VALUE_DELIMITER_SUFFIX
default Optional<com.querydsl.core.types.Predicate> getPredicate(P path, V value)
Default implementation delegates to getExpression(Path, Object)
default Optional<com.querydsl.core.types.dsl.BooleanExpression> getExpression(P path, V value)
BooleanExpression based on implementation specific
logic's processing of supplied value(s).
Default implementation returns an empty Optional.
path - Q Path Path for which expression is to be formed using supplied valuevalue - Input value value(s) to be used to form expression, this can be a primitive or a collection of values but must not be wrapped in OptionalOptional of BooleanExpression based on provided value.UnsupportedOperationException - if an operator is used in unsupported order or on unsupported digits
(for example, startWith operator being used on String values)static <S extends String> Optional<Operator> isOperator(S value)
value - input string to check for OperatorOperator if supplied String starts with an operator, empty Optional otherwiseUnsupportedOperationException - if an operator is used in unsupported order or on unsupported digits
(for example, startWith operator being used on String values)static <S extends String> Optional<Operator> isOperator(Operator[] operators, S value)
value - input string to check for Operatoroperators - List of operators to check againstOperator if supplied String starts with an operator, empty Optional otherwiseUnsupportedOperationException - if an operator is used in unsupported order or on unsupported digits
(for example, startWith operator being used on String values)static boolean isOperator(Operator operator, String value)
true if provided value is wrapped in supplied operatoroperator - Operator to check for on provided valuevalue - value to check against if it's wrapped in provided operatortrue if provided value is wrapped in supplied operator, false otherwisestatic void validateComposition(String value)
valuevalue - value to check for proper compositionIllegalArgumentException - if an invalid composition is found in provided valueCopyright © 2018–2019. All rights reserved.