-
Notifications
You must be signed in to change notification settings - Fork 55
/
CriteriaBuilder.java
1564 lines (1333 loc) · 47.7 KB
/
CriteriaBuilder.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2008, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
// Contributors:
// Linda DeMichiel - 2.1
// Linda DeMichiel - 2.0
package jakarta.persistence.criteria;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import jakarta.persistence.Tuple;
/**
* Used to construct criteria queries, compound selections,
* expressions, predicates, orderings.
*
* <p> Note that <code>Predicate</code> is used instead of <code>Expression<Boolean></code>
* in this API in order to work around the fact that Java
* generics are not compatible with varags.
*
* @since 2.0
*/
public interface CriteriaBuilder {
/**
* Create a <code>CriteriaQuery</code> object.
* @return criteria query object
*/
CriteriaQuery<Object> createQuery();
/**
* Create a <code>CriteriaQuery</code> object with the specified result
* type.
* @param resultClass type of the query result
* @return criteria query object
*/
<T> CriteriaQuery<T> createQuery(Class<T> resultClass);
/**
* Create a <code>CriteriaQuery</code> object that returns a tuple of
* objects as its result.
* @return criteria query object
*/
CriteriaQuery<Tuple> createTupleQuery();
// methods to construct queries for bulk updates and deletes:
/**
* Create a <code>CriteriaUpdate</code> query object to perform a bulk update operation.
* @param targetEntity target type for update operation
* @return the query object
* @since 2.1
*/
<T> CriteriaUpdate<T> createCriteriaUpdate(Class<T> targetEntity);
/**
* Create a <code>CriteriaDelete</code> query object to perform a bulk delete operation.
* @param targetEntity target type for delete operation
* @return the query object
* @since 2.1
*/
<T> CriteriaDelete<T> createCriteriaDelete(Class<T> targetEntity);
// selection construction methods:
/**
* Create a selection item corresponding to a constructor.
* This method is used to specify a constructor that will be
* applied to the results of the query execution. If the
* constructor is for an entity class, the resulting entities
* will be in the new state after the query is executed.
* @param resultClass class whose instance is to be constructed
* @param selections arguments to the constructor
* @return compound selection item
* @throws IllegalArgumentException if an argument is a
* tuple- or array-valued selection item
*/
<Y> CompoundSelection<Y> construct(Class<Y> resultClass, Selection<?>... selections);
/**
* Create a tuple-valued selection item.
* @param selections selection items
* @return tuple-valued compound selection
* @throws IllegalArgumentException if an argument is a
* tuple- or array-valued selection item
*/
CompoundSelection<Tuple> tuple(Selection<?>... selections);
/**
* Create an array-valued selection item.
* @param selections selection items
* @return array-valued compound selection
* @throws IllegalArgumentException if an argument is a
* tuple- or array-valued selection item
*/
CompoundSelection<Object[]> array(Selection<?>... selections);
//ordering:
/**
* Create an ordering by the ascending value of the expression.
* @param x expression used to define the ordering
* @return ascending ordering corresponding to the expression
*/
Order asc(Expression<?> x);
/**
* Create an ordering by the descending value of the expression.
* @param x expression used to define the ordering
* @return descending ordering corresponding to the expression
*/
Order desc(Expression<?> x);
//aggregate functions:
/**
* Create an aggregate expression applying the avg operation.
* @param x expression representing input value to avg operation
* @return avg expression
*/
<N extends Number> Expression<Double> avg(Expression<N> x);
/**
* Create an aggregate expression applying the sum operation.
* @param x expression representing input value to sum operation
* @return sum expression
*/
<N extends Number> Expression<N> sum(Expression<N> x);
/**
* Create an aggregate expression applying the sum operation to an
* Integer-valued expression, returning a Long result.
* @param x expression representing input value to sum operation
* @return sum expression
*/
Expression<Long> sumAsLong(Expression<Integer> x);
/**
* Create an aggregate expression applying the sum operation to a
* Float-valued expression, returning a Double result.
* @param x expression representing input value to sum operation
* @return sum expression
*/
Expression<Double> sumAsDouble(Expression<Float> x);
/**
* Create an aggregate expression applying the numerical max
* operation.
* @param x expression representing input value to max operation
* @return max expression
*/
<N extends Number> Expression<N> max(Expression<N> x);
/**
* Create an aggregate expression applying the numerical min
* operation.
* @param x expression representing input value to min operation
* @return min expression
*/
<N extends Number> Expression<N> min(Expression<N> x);
/**
* Create an aggregate expression for finding the greatest of
* the values (strings, dates, etc).
* @param x expression representing input value to greatest
* operation
* @return greatest expression
*/
<X extends Comparable<? super X>> Expression<X> greatest(Expression<X> x);
/**
* Create an aggregate expression for finding the least of
* the values (strings, dates, etc).
* @param x expression representing input value to least
* operation
* @return least expression
*/
<X extends Comparable<? super X>> Expression<X> least(Expression<X> x);
/**
* Create an aggregate expression applying the count operation.
* @param x expression representing input value to count
* operation
* @return count expression
*/
Expression<Long> count(Expression<?> x);
/**
* Create an aggregate expression applying the count distinct
* operation.
* @param x expression representing input value to
* count distinct operation
* @return count distinct expression
*/
Expression<Long> countDistinct(Expression<?> x);
//subqueries:
/**
* Create a predicate testing the existence of a subquery result.
* @param subquery subquery whose result is to be tested
* @return exists predicate
*/
Predicate exists(Subquery<?> subquery);
/**
* Create an all expression over the subquery results.
* @param subquery subquery
* @return all expression
*/
<Y> Expression<Y> all(Subquery<Y> subquery);
/**
* Create a some expression over the subquery results.
* This expression is equivalent to an <code>any</code> expression.
* @param subquery subquery
* @return some expression
*/
<Y> Expression<Y> some(Subquery<Y> subquery);
/**
* Create an any expression over the subquery results.
* This expression is equivalent to a <code>some</code> expression.
* @param subquery subquery
* @return any expression
*/
<Y> Expression<Y> any(Subquery<Y> subquery);
//boolean functions:
/**
* Create a conjunction of the given boolean expressions.
* @param x boolean expression
* @param y boolean expression
* @return and predicate
*/
Predicate and(Expression<Boolean> x, Expression<Boolean> y);
/**
* Create a conjunction of the given restriction predicates.
* A conjunction of zero predicates is true.
* @param restrictions zero or more restriction predicates
* @return and predicate
*/
Predicate and(Predicate... restrictions);
/**
* Create a disjunction of the given boolean expressions.
* @param x boolean expression
* @param y boolean expression
* @return or predicate
*/
Predicate or(Expression<Boolean> x, Expression<Boolean> y);
/**
* Create a disjunction of the given restriction predicates.
* A disjunction of zero predicates is false.
* @param restrictions zero or more restriction predicates
* @return or predicate
*/
Predicate or(Predicate... restrictions);
/**
* Create a negation of the given restriction.
* @param restriction restriction expression
* @return not predicate
*/
Predicate not(Expression<Boolean> restriction);
/**
* Create a conjunction (with zero conjuncts).
* A conjunction with zero conjuncts is true.
* @return and predicate
*/
Predicate conjunction();
/**
* Create a disjunction (with zero disjuncts).
* A disjunction with zero disjuncts is false.
* @return or predicate
*/
Predicate disjunction();
//turn Expression<Boolean> into a Predicate
//useful for use with varargs methods
/**
* Create a predicate testing for a true value.
* @param x expression to be tested
* @return predicate
*/
Predicate isTrue(Expression<Boolean> x);
/**
* Create a predicate testing for a false value.
* @param x expression to be tested
* @return predicate
*/
Predicate isFalse(Expression<Boolean> x);
//null tests:
/**
* Create a predicate to test whether the expression is null.
* @param x expression
* @return is-null predicate
*/
Predicate isNull(Expression<?> x);
/**
* Create a predicate to test whether the expression is not null.
* @param x expression
* @return is-not-null predicate
*/
Predicate isNotNull(Expression<?> x);
//equality:
/**
* Create a predicate for testing the arguments for equality.
* @param x expression
* @param y expression
* @return equality predicate
*/
Predicate equal(Expression<?> x, Expression<?> y);
/**
* Create a predicate for testing the arguments for equality.
* @param x expression
* @param y object
* @return equality predicate
*/
Predicate equal(Expression<?> x, Object y);
/**
* Create a predicate for testing the arguments for inequality.
* @param x expression
* @param y expression
* @return inequality predicate
*/
Predicate notEqual(Expression<?> x, Expression<?> y);
/**
* Create a predicate for testing the arguments for inequality.
* @param x expression
* @param y object
* @return inequality predicate
*/
Predicate notEqual(Expression<?> x, Object y);
//comparisons for generic (non-numeric) operands:
/**
* Create a predicate for testing whether the first argument is
* greater than the second.
* @param x expression
* @param y expression
* @return greater-than predicate
*/
<Y extends Comparable<? super Y>> Predicate greaterThan(Expression<? extends Y> x, Expression<? extends Y> y);
/**
* Create a predicate for testing whether the first argument is
* greater than the second.
* @param x expression
* @param y value
* @return greater-than predicate
*/
<Y extends Comparable<? super Y>> Predicate greaterThan(Expression<? extends Y> x, Y y);
/**
* Create a predicate for testing whether the first argument is
* greater than or equal to the second.
* @param x expression
* @param y expression
* @return greater-than-or-equal predicate
*/
<Y extends Comparable<? super Y>> Predicate greaterThanOrEqualTo(Expression<? extends Y> x, Expression<? extends Y> y);
/**
* Create a predicate for testing whether the first argument is
* greater than or equal to the second.
* @param x expression
* @param y value
* @return greater-than-or-equal predicate
*/
<Y extends Comparable<? super Y>> Predicate greaterThanOrEqualTo(Expression<? extends Y> x, Y y);
/**
* Create a predicate for testing whether the first argument is
* less than the second.
* @param x expression
* @param y expression
* @return less-than predicate
*/
<Y extends Comparable<? super Y>> Predicate lessThan(Expression<? extends Y> x, Expression<? extends Y> y);
/**
* Create a predicate for testing whether the first argument is
* less than the second.
* @param x expression
* @param y value
* @return less-than predicate
*/
<Y extends Comparable<? super Y>> Predicate lessThan(Expression<? extends Y> x, Y y);
/**
* Create a predicate for testing whether the first argument is
* less than or equal to the second.
* @param x expression
* @param y expression
* @return less-than-or-equal predicate
*/
<Y extends Comparable<? super Y>> Predicate lessThanOrEqualTo(Expression<? extends Y> x, Expression<? extends Y> y);
/**
* Create a predicate for testing whether the first argument is
* less than or equal to the second.
* @param x expression
* @param y value
* @return less-than-or-equal predicate
*/
<Y extends Comparable<? super Y>> Predicate lessThanOrEqualTo(Expression<? extends Y> x, Y y);
/**
* Create a predicate for testing whether the first argument is
* between the second and third arguments in value.
* @param v expression
* @param x expression
* @param y expression
* @return between predicate
*/
<Y extends Comparable<? super Y>> Predicate between(Expression<? extends Y> v, Expression<? extends Y> x, Expression<? extends Y> y);
/**
* Create a predicate for testing whether the first argument is
* between the second and third arguments in value.
* @param v expression
* @param x value
* @param y value
* @return between predicate
*/
<Y extends Comparable<? super Y>> Predicate between(Expression<? extends Y> v, Y x, Y y);
//comparisons for numeric operands:
/**
* Create a predicate for testing whether the first argument is
* greater than the second.
* @param x expression
* @param y expression
* @return greater-than predicate
*/
Predicate gt(Expression<? extends Number> x, Expression<? extends Number> y);
/**
* Create a predicate for testing whether the first argument is
* greater than the second.
* @param x expression
* @param y value
* @return greater-than predicate
*/
Predicate gt(Expression<? extends Number> x, Number y);
/**
* Create a predicate for testing whether the first argument is
* greater than or equal to the second.
* @param x expression
* @param y expression
* @return greater-than-or-equal predicate
*/
Predicate ge(Expression<? extends Number> x, Expression<? extends Number> y);
/**
* Create a predicate for testing whether the first argument is
* greater than or equal to the second.
* @param x expression
* @param y value
* @return greater-than-or-equal predicate
*/
Predicate ge(Expression<? extends Number> x, Number y);
/**
* Create a predicate for testing whether the first argument is
* less than the second.
* @param x expression
* @param y expression
* @return less-than predicate
*/
Predicate lt(Expression<? extends Number> x, Expression<? extends Number> y);
/**
* Create a predicate for testing whether the first argument is
* less than the second.
* @param x expression
* @param y value
* @return less-than predicate
*/
Predicate lt(Expression<? extends Number> x, Number y);
/**
* Create a predicate for testing whether the first argument is
* less than or equal to the second.
* @param x expression
* @param y expression
* @return less-than-or-equal predicate
*/
Predicate le(Expression<? extends Number> x, Expression<? extends Number> y);
/**
* Create a predicate for testing whether the first argument is
* less than or equal to the second.
* @param x expression
* @param y value
* @return less-than-or-equal predicate
*/
Predicate le(Expression<? extends Number> x, Number y);
//numerical operations:
/**
* Create an expression that returns the arithmetic negation
* of its argument.
* @param x expression
* @return arithmetic negation
*/
<N extends Number> Expression<N> neg(Expression<N> x);
/**
* Create an expression that returns the absolute value
* of its argument.
* @param x expression
* @return absolute value
*/
<N extends Number> Expression<N> abs(Expression<N> x);
/**
* Create an expression that returns the sum
* of its arguments.
* @param x expression
* @param y expression
* @return sum
*/
<N extends Number> Expression<N> sum(Expression<? extends N> x, Expression<? extends N> y);
/**
* Create an expression that returns the sum
* of its arguments.
* @param x expression
* @param y value
* @return sum
*/
<N extends Number> Expression<N> sum(Expression<? extends N> x, N y);
/**
* Create an expression that returns the sum
* of its arguments.
* @param x value
* @param y expression
* @return sum
*/
<N extends Number> Expression<N> sum(N x, Expression<? extends N> y);
/**
* Create an expression that returns the product
* of its arguments.
* @param x expression
* @param y expression
* @return product
*/
<N extends Number> Expression<N> prod(Expression<? extends N> x, Expression<? extends N> y);
/**
* Create an expression that returns the product
* of its arguments.
* @param x expression
* @param y value
* @return product
*/
<N extends Number> Expression<N> prod(Expression<? extends N> x, N y);
/**
* Create an expression that returns the product
* of its arguments.
* @param x value
* @param y expression
* @return product
*/
<N extends Number> Expression<N> prod(N x, Expression<? extends N> y);
/**
* Create an expression that returns the difference
* between its arguments.
* @param x expression
* @param y expression
* @return difference
*/
<N extends Number> Expression<N> diff(Expression<? extends N> x, Expression<? extends N> y);
/**
* Create an expression that returns the difference
* between its arguments.
* @param x expression
* @param y value
* @return difference
*/
<N extends Number> Expression<N> diff(Expression<? extends N> x, N y);
/**
* Create an expression that returns the difference
* between its arguments.
* @param x value
* @param y expression
* @return difference
*/
<N extends Number> Expression<N> diff(N x, Expression<? extends N> y);
/**
* Create an expression that returns the quotient
* of its arguments.
* @param x expression
* @param y expression
* @return quotient
*/
Expression<Number> quot(Expression<? extends Number> x, Expression<? extends Number> y);
/**
* Create an expression that returns the quotient
* of its arguments.
* @param x expression
* @param y value
* @return quotient
*/
Expression<Number> quot(Expression<? extends Number> x, Number y);
/**
* Create an expression that returns the quotient
* of its arguments.
* @param x value
* @param y expression
* @return quotient
*/
Expression<Number> quot(Number x, Expression<? extends Number> y);
/**
* Create an expression that returns the modulus
* of its arguments.
* @param x expression
* @param y expression
* @return modulus
*/
Expression<Integer> mod(Expression<Integer> x, Expression<Integer> y);
/**
* Create an expression that returns the modulus
* of its arguments.
* @param x expression
* @param y value
* @return modulus
*/
Expression<Integer> mod(Expression<Integer> x, Integer y);
/**
* Create an expression that returns the modulus
* of its arguments.
* @param x value
* @param y expression
* @return modulus
*/
Expression<Integer> mod(Integer x, Expression<Integer> y);
/**
* Create an expression that returns the square root
* of its argument.
* @param x expression
* @return square root
*/
Expression<Double> sqrt(Expression<? extends Number> x);
//typecasts:
/**
* Typecast. Returns same expression object.
* @param number numeric expression
* @return Expression<Long>
*/
Expression<Long> toLong(Expression<? extends Number> number);
/**
* Typecast. Returns same expression object.
* @param number numeric expression
* @return Expression<Integer>
*/
Expression<Integer> toInteger(Expression<? extends Number> number);
/**
* Typecast. Returns same expression object.
* @param number numeric expression
* @return Expression<Float>
*/
Expression<Float> toFloat(Expression<? extends Number> number);
/**
* Typecast. Returns same expression object.
* @param number numeric expression
* @return Expression<Double>
*/
Expression<Double> toDouble(Expression<? extends Number> number);
/**
* Typecast. Returns same expression object.
* @param number numeric expression
* @return Expression<BigDecimal>
*/
Expression<BigDecimal> toBigDecimal(Expression<? extends Number> number);
/**
* Typecast. Returns same expression object.
* @param number numeric expression
* @return Expression<BigInteger>
*/
Expression<BigInteger> toBigInteger(Expression<? extends Number> number);
/**
* Typecast. Returns same expression object.
* @param character expression
* @return Expression<String>
*/
Expression<String> toString(Expression<Character> character);
//literals:
/**
* Create an expression for a literal.
* @param value value represented by the expression
* @return expression literal
* @throws IllegalArgumentException if value is null
*/
<T> Expression<T> literal(T value);
/**
* Create an expression for a null literal with the given type.
* @param resultClass type of the null literal
* @return null expression literal
*/
<T> Expression<T> nullLiteral(Class<T> resultClass);
//parameters:
/**
* Create a parameter expression.
* @param paramClass parameter class
* @return parameter expression
*/
<T> ParameterExpression<T> parameter(Class<T> paramClass);
/**
* Create a parameter expression with the given name.
* @param paramClass parameter class
* @param name name that can be used to refer to
* the parameter
* @return parameter expression
*/
<T> ParameterExpression<T> parameter(Class<T> paramClass, String name);
//collection operations:
/**
* Create a predicate that tests whether a collection is empty.
* @param collection expression
* @return is-empty predicate
*/
<C extends Collection<?>> Predicate isEmpty(Expression<C> collection);
/**
* Create a predicate that tests whether a collection is
* not empty.
* @param collection expression
* @return is-not-empty predicate
*/
<C extends Collection<?>> Predicate isNotEmpty(Expression<C> collection);
/**
* Create an expression that tests the size of a collection.
* @param collection expression
* @return size expression
*/
<C extends Collection<?>> Expression<Integer> size(Expression<C> collection);
/**
* Create an expression that tests the size of a collection.
* @param collection collection
* @return size expression
*/
<C extends Collection<?>> Expression<Integer> size(C collection);
/**
* Create a predicate that tests whether an element is
* a member of a collection.
* If the collection is empty, the predicate will be false.
* @param elem element expression
* @param collection expression
* @return is-member predicate
*/
<E, C extends Collection<E>> Predicate isMember(Expression<E> elem, Expression<C> collection);
/**
* Create a predicate that tests whether an element is
* a member of a collection.
* If the collection is empty, the predicate will be false.
* @param elem element
* @param collection expression
* @return is-member predicate
*/
<E, C extends Collection<E>> Predicate isMember(E elem, Expression<C> collection);
/**
* Create a predicate that tests whether an element is
* not a member of a collection.
* If the collection is empty, the predicate will be true.
* @param elem element expression
* @param collection expression
* @return is-not-member predicate
*/
<E, C extends Collection<E>> Predicate isNotMember(Expression<E> elem, Expression<C> collection);
/**
* Create a predicate that tests whether an element is
* not a member of a collection.
* If the collection is empty, the predicate will be true.
* @param elem element
* @param collection expression
* @return is-not-member predicate
*/
<E, C extends Collection<E>> Predicate isNotMember(E elem, Expression<C> collection);
//get the values and keys collections of the Map, which may then
//be passed to size(), isMember(), isEmpty(), etc
/**
* Create an expression that returns the values of a map.
* @param map map
* @return collection expression
*/
<V, M extends Map<?, V>> Expression<Collection<V>> values(M map);
/**
* Create an expression that returns the keys of a map.
* @param map map
* @return set expression
*/
<K, M extends Map<K, ?>> Expression<Set<K>> keys(M map);
//string functions:
/**
* Create a predicate for testing whether the expression
* satisfies the given pattern.
* @param x string expression
* @param pattern string expression
* @return like predicate
*/
Predicate like(Expression<String> x, Expression<String> pattern);
/**
* Create a predicate for testing whether the expression
* satisfies the given pattern.
* @param x string expression
* @param pattern string
* @return like predicate
*/
Predicate like(Expression<String> x, String pattern);
/**
* Create a predicate for testing whether the expression
* satisfies the given pattern.
* @param x string expression
* @param pattern string expression
* @param escapeChar escape character expression
* @return like predicate
*/
Predicate like(Expression<String> x, Expression<String> pattern, Expression<Character> escapeChar);
/**
* Create a predicate for testing whether the expression
* satisfies the given pattern.
* @param x string expression
* @param pattern string expression
* @param escapeChar escape character
* @return like predicate
*/
Predicate like(Expression<String> x, Expression<String> pattern, char escapeChar);
/**
* Create a predicate for testing whether the expression
* satisfies the given pattern.
* @param x string expression
* @param pattern string
* @param escapeChar escape character expression
* @return like predicate
*/
Predicate like(Expression<String> x, String pattern, Expression<Character> escapeChar);
/**
* Create a predicate for testing whether the expression
* satisfies the given pattern.
* @param x string expression
* @param pattern string
* @param escapeChar escape character
* @return like predicate
*/
Predicate like(Expression<String> x, String pattern, char escapeChar);
/**
* Create a predicate for testing whether the expression
* does not satisfy the given pattern.
* @param x string expression
* @param pattern string expression
* @return not-like predicate
*/
Predicate notLike(Expression<String> x, Expression<String> pattern);
/**
* Create a predicate for testing whether the expression
* does not satisfy the given pattern.
* @param x string expression
* @param pattern string
* @return not-like predicate
*/
Predicate notLike(Expression<String> x, String pattern);
/**
* Create a predicate for testing whether the expression
* does not satisfy the given pattern.
* @param x string expression
* @param pattern string expression
* @param escapeChar escape character expression
* @return not-like predicate
*/
Predicate notLike(Expression<String> x, Expression<String> pattern, Expression<Character> escapeChar);
/**
* Create a predicate for testing whether the expression
* does not satisfy the given pattern.
* @param x string expression
* @param pattern string expression
* @param escapeChar escape character
* @return not-like predicate
*/
Predicate notLike(Expression<String> x, Expression<String> pattern, char escapeChar);
/**
* Create a predicate for testing whether the expression
* does not satisfy the given pattern.
* @param x string expression
* @param pattern string
* @param escapeChar escape character expression
* @return not-like predicate
*/
Predicate notLike(Expression<String> x, String pattern, Expression<Character> escapeChar);
/**
* Create a predicate for testing whether the expression
* does not satisfy the given pattern.
* @param x string expression
* @param pattern string
* @param escapeChar escape character
* @return not-like predicate
*/
Predicate notLike(Expression<String> x, String pattern, char escapeChar);