Interface CaseWhenStarterBuilder<T>
- Type Parameters:
T- The builder type that is returned on terminal operations
- All Known Subinterfaces:
CaseWhenBuilder<T>
- Since:
- 1.0.0
- Author:
- Christian Beikov
-
Method Summary
Modifier and TypeMethodDescriptionStarts aRestrictionBuilderto create a when predicate where expression will be on the left hand side of the predicate.whenAnd()Starts aCaseWhenAndThenBuilderwhich is a predicate consisting only of conjunctive connected predicates.Starts an exists predicate for the when clause with a subquery on the right hand side.whenExists(FullQueryBuilder<?, ?> criteriaBuilder) Starts an exists predicate for the when clause with a subquery on the right hand side based on the given criteria builder.Starts an exists predicate for the when clause with a subquery on the right hand side.whenNotExists(FullQueryBuilder<?, ?> criteriaBuilder) Starts an exists predicate for the when clause with a subquery on the right hand side based on the given criteria builder.whenOr()Starts aCaseWhenOrThenBuilderwhich is a predicate consisting only of disjunctiv connected predicates.whenSubqueries(String expression) Starts aSubqueryInitiatorfor the left hand side of a when predicate.Starts aSubqueryInitiatorfor the left hand side of a when predicate.whenSubquery(FullQueryBuilder<?, ?> criteriaBuilder) Starts aSubqueryBuilderbased on the given criteria builder for the left hand side of a when predicate.whenSubquery(String subqueryAlias, String expression) Starts aSubqueryInitiatorfor the left hand side of a when predicate.whenSubquery(String subqueryAlias, String expression, FullQueryBuilder<?, ?> criteriaBuilder) Starts aSubqueryBuilderbased on the given criteria builder for the left hand side of a when predicate.
-
Method Details
-
when
Starts aRestrictionBuilderto create a when predicate where expression will be on the left hand side of the predicate.- Parameters:
expression- The left hand expression for a when predicate- Returns:
- The restriction builder for the given expression
-
whenSubquery
SubqueryInitiator<RestrictionBuilder<CaseWhenThenBuilder<CaseWhenBuilder<T>>>> whenSubquery()Starts aSubqueryInitiatorfor the left hand side of a when predicate. When the subquery builder and the restriction builder for the right hand side are finished, the when predicate in conjunction with it's then expression are added to the case when builder.- Returns:
- The subquery initiator for building a subquery
-
whenSubquery
SubqueryInitiator<RestrictionBuilder<CaseWhenThenBuilder<CaseWhenBuilder<T>>>> whenSubquery(String subqueryAlias, String expression) Starts aSubqueryInitiatorfor the left hand side of a when predicate. All occurrences ofsubqueryAliasinexpressionwill be replaced by the subquery. This allows to build expressions containing subqueries like following example shows:whenSubquery("x", "x * 2 + 1").from(Person.class, "p").select("COUNT(p)").end();results in:
(SELECT COUNT(p) FROM Person p) * 2 + 1When the subquery builder and the restriction builder for the right hand side are finished, the when predicate in conjunction with it's then expression are added to the case when builder.
- Parameters:
subqueryAlias- The alias for the subquery which will be replaced by the actual subqueryexpression- The expression which will be used as left hand side of a predicate. This expression contains thesubqueryAliasto define the insertion points for the subquery.- Returns:
- The subquery initiator for building a subquery
-
whenSubqueries
MultipleSubqueryInitiator<RestrictionBuilder<CaseWhenThenBuilder<CaseWhenBuilder<T>>>> whenSubqueries(String expression) Starts aSubqueryInitiatorfor the left hand side of a when predicate.All occurrences of subsequently defined
subqueryAliases inexpressionwill be replaced by the respective subquery. When the builder finishes, the resulting expression is used for the left hand side of a when predicate.- Parameters:
expression- The expression which will be used as left hand side of a when predicate- Returns:
- The subquery initiator for building multiple subqueries for their respective subqueryAliases
- Since:
- 1.2.0
-
whenSubquery
SubqueryBuilder<RestrictionBuilder<CaseWhenThenBuilder<CaseWhenBuilder<T>>>> whenSubquery(FullQueryBuilder<?, ?> criteriaBuilder) Starts aSubqueryBuilderbased on the given criteria builder for the left hand side of a when predicate. When the subquery builder and the restriction builder for the right hand side are finished, the when predicate in conjunction with it's then expression are added to the case when builder.- Parameters:
criteriaBuilder- The criteria builder to base the subquery on- Returns:
- The subquery builder for building a subquery
- Since:
- 1.2.0
-
whenSubquery
SubqueryBuilder<RestrictionBuilder<CaseWhenThenBuilder<CaseWhenBuilder<T>>>> whenSubquery(String subqueryAlias, String expression, FullQueryBuilder<?, ?> criteriaBuilder) Starts aSubqueryBuilderbased on the given criteria builder for the left hand side of a when predicate. All occurrences ofsubqueryAliasinexpressionwill be replaced by the subquery. This allows to build expressions containing subqueries like following example shows:whenSubquery("x", "x * 2 + 1").from(Person.class, "p").select("COUNT(p)").end();results in:
(SELECT COUNT(p) FROM Person p) * 2 + 1When the subquery builder and the restriction builder for the right hand side are finished, the when predicate in conjunction with it's then expression are added to the case when builder.
- Parameters:
subqueryAlias- The alias for the subquery which will be replaced by the actual subqueryexpression- The expression which will be used as left hand side of a predicate. This expression contains thesubqueryAliasto define the insertion points for the subquery.criteriaBuilder- The criteria builder to base the subquery on- Returns:
- The subquery builder for building a subquery
- Since:
- 1.2.0
-
whenExists
SubqueryInitiator<CaseWhenThenBuilder<CaseWhenBuilder<T>>> whenExists()Starts an exists predicate for the when clause with a subquery on the right hand side. When the builder finishes, the when predicate in conjunction with it's then expression are added to the case when builder.- Returns:
- The subquery initiator for building a subquery
-
whenNotExists
SubqueryInitiator<CaseWhenThenBuilder<CaseWhenBuilder<T>>> whenNotExists()Starts an exists predicate for the when clause with a subquery on the right hand side. When the builder finishes, the when predicate in conjunction with it's then expression are added to the case when builder.- Returns:
- The subquery initiator for building a subquery
-
whenExists
SubqueryBuilder<CaseWhenThenBuilder<CaseWhenBuilder<T>>> whenExists(FullQueryBuilder<?, ?> criteriaBuilder) Starts an exists predicate for the when clause with a subquery on the right hand side based on the given criteria builder. When the builder finishes, the when predicate in conjunction with it's then expression are added to the case when builder.- Parameters:
criteriaBuilder- The criteria builder to base the subquery on- Returns:
- The subquery builder for building a subquery
- Since:
- 1.2.0
-
whenNotExists
SubqueryBuilder<CaseWhenThenBuilder<CaseWhenBuilder<T>>> whenNotExists(FullQueryBuilder<?, ?> criteriaBuilder) Starts an exists predicate for the when clause with a subquery on the right hand side based on the given criteria builder. When the builder finishes, the when predicate in conjunction with it's then expression are added to the case when builder.- Parameters:
criteriaBuilder- The criteria builder to base the subquery on- Returns:
- The subquery builder for building a subquery
- Since:
- 1.2.0
-
whenAnd
CaseWhenAndThenBuilder<CaseWhenBuilder<T>> whenAnd()Starts aCaseWhenAndThenBuilderwhich is a predicate consisting only of conjunctive connected predicates. When the builder finishes, the when predicate in conjunction with it's then expression are added to the case when builder.- Returns:
- The and predicate builder for the when expression
-
whenOr
CaseWhenOrThenBuilder<CaseWhenBuilder<T>> whenOr()Starts aCaseWhenOrThenBuilderwhich is a predicate consisting only of disjunctiv connected predicates. When the builder finishes, the when predicate in conjunction with it's then expression are added to the case when builder.- Returns:
- The or predicate builder for the when expression
-