@@ -6436,12 +6436,52 @@ private void assertNotBuilder(Object toCheck, String name) {
6436
6436
/**
6437
6437
* Get a builder that allows fluent creation of {@link Cond}.
6438
6438
*
6439
- * @return a new {@link ConditionalExpressionBuilder }.
6439
+ * @return never {@literal null }.
6440
6440
*/
6441
- public static ConditionalExpressionBuilder newBuilder () {
6441
+ public static WhenBuilder newBuilder () {
6442
6442
return ConditionalExpressionBuilder .newBuilder ();
6443
6443
}
6444
6444
6445
+ /**
6446
+ * Start creating new {@link Cond} by providing the boolean expression used in {@code if}.
6447
+ *
6448
+ * @param booleanExpression must not be {@literal null}.
6449
+ * @return never {@literal null}.
6450
+ */
6451
+ public static ThenBuilder when (Document booleanExpression ) {
6452
+ return ConditionalExpressionBuilder .newBuilder ().when (booleanExpression );
6453
+ }
6454
+
6455
+ /**
6456
+ * Start creating new {@link Cond} by providing the {@link AggregationExpression} used in {@code if}.
6457
+ *
6458
+ * @param expression expression that yields in a boolean result, must not be {@literal null}.
6459
+ * @return never {@literal null}.
6460
+ */
6461
+ public static ThenBuilder when (AggregationExpression expression ) {
6462
+ return ConditionalExpressionBuilder .newBuilder ().when (expression );
6463
+ }
6464
+
6465
+ /**
6466
+ * Start creating new {@link Cond} by providing the field reference used in {@code if}.
6467
+ *
6468
+ * @param booleanField name of a field holding a boolean value, must not be {@literal null}.
6469
+ * @return never {@literal null}.
6470
+ */
6471
+ public static ThenBuilder when (String booleanField ) {
6472
+ return ConditionalExpressionBuilder .newBuilder ().when (booleanField );
6473
+ }
6474
+
6475
+ /**
6476
+ * Start creating new {@link Cond} by providing the {@link CriteriaDefinition} used in {@code if}.
6477
+ *
6478
+ * @param criteria criteria to evaluate, must not be {@literal null}.
6479
+ * @return the {@link ThenBuilder}
6480
+ */
6481
+ public static ThenBuilder when (CriteriaDefinition criteria ) {
6482
+ return ConditionalExpressionBuilder .newBuilder ().when (criteria );
6483
+ }
6484
+
6445
6485
/**
6446
6486
* @author Mark Paluch
6447
6487
*/
0 commit comments