@@ -1032,35 +1032,68 @@ public Slice itemCount(int nrElements) {
1032
1032
return new Slice (append (nrElements ));
1033
1033
}
1034
1034
1035
+ /**
1036
+ * Slice the number of elements.
1037
+ *
1038
+ * @param nrElements An {@link AggregationExpression} that evaluates to a numeric value used as item count.
1039
+ * @return new instance of {@link Slice}.
1040
+ * @since 4.5
1041
+ */
1042
+ public Slice itemCount (AggregationExpression nrElements ) {
1043
+ return new Slice (append (nrElements ));
1044
+ }
1045
+
1035
1046
/**
1036
1047
* Slice using offset and count.
1037
1048
*
1038
1049
* @param position the start position
1039
1050
* @return new instance of {@link SliceElementsBuilder} to create {@link Slice}.
1040
1051
*/
1041
- public SliceElementsBuilder offset (final int position ) {
1042
-
1043
- return new SliceElementsBuilder () {
1052
+ public SliceElementsBuilder offset (int position ) {
1053
+ return new SliceElementsBuilder ( position );
1054
+ }
1044
1055
1045
- @ Override
1046
- public Slice itemCount (int nrElements ) {
1047
- return new Slice (append (position )).itemCount (nrElements );
1048
- }
1049
- };
1056
+ /**
1057
+ * Slice using offset and count.
1058
+ *
1059
+ * @param position the start position
1060
+ * @return new instance of {@link SliceElementsBuilder} to create {@link Slice}.
1061
+ */
1062
+ public SliceElementsBuilder offset (AggregationExpression position ) {
1063
+ return new SliceElementsBuilder (position );
1050
1064
}
1051
1065
1052
1066
/**
1053
1067
* @author Christoph Strobl
1054
1068
*/
1055
- public interface SliceElementsBuilder {
1069
+ public class SliceElementsBuilder {
1070
+
1071
+ private final Object position ;
1072
+
1073
+ SliceElementsBuilder (Object position ) {
1074
+ this .position = position ;
1075
+ }
1056
1076
1057
1077
/**
1058
1078
* Set the number of elements given {@literal nrElements}.
1059
1079
*
1060
1080
* @param nrElements
1061
- * @return
1081
+ * @return new instance of {@link Slice}.
1062
1082
*/
1063
- Slice itemCount (int nrElements );
1083
+ public Slice itemCount (int nrElements ) {
1084
+ return new Slice (append (position )).itemCount (nrElements );
1085
+ }
1086
+
1087
+ /**
1088
+ * Slice the number of elements.
1089
+ *
1090
+ * @param nrElements An {@link AggregationExpression} that evaluates to a numeric value used as item count.
1091
+ * @return new instance of {@link Slice}.
1092
+ * @since 4.5
1093
+ */
1094
+ public Slice itemCount (AggregationExpression nrElements ) {
1095
+ return new Slice (append (position )).itemCount (nrElements );
1096
+ }
1064
1097
}
1065
1098
}
1066
1099
0 commit comments