@@ -160,6 +160,18 @@ private Optional<RenderedCriterion> calculateRenderedCriterion(FragmentAndParame
160160 collectSqlFragments (initialCriterion , renderedSubCriteria ), fragmentCalculator ));
161161 }
162162
163+ private RenderedCriterion calculateRenderedCriterion (FragmentCollector fragmentCollector ,
164+ Function <FragmentCollector , String > fragmentCalculator ) {
165+ FragmentAndParameters fragmentAndParameters = FragmentAndParameters
166+ .withFragment (fragmentCalculator .apply (fragmentCollector ))
167+ .withParameters (fragmentCollector .parameters ())
168+ .build ();
169+
170+ return new RenderedCriterion .Builder ()
171+ .withFragmentAndParameters (fragmentAndParameters )
172+ .build ();
173+ }
174+
163175 private Optional <RenderedCriterion > calculateRenderedCriterion (List <RenderedCriterion > renderedSubCriteria ,
164176 Function <FragmentCollector , String > fragmentCalculator ) {
165177 return collectSqlFragments (renderedSubCriteria ).map (fc -> calculateRenderedCriterion (fc , fragmentCalculator ));
@@ -181,8 +193,7 @@ private <T> FragmentAndParameters renderCondition(ColumnAndConditionCriterion<T>
181193 * and there may be subcriteria. The collector will contain the initial condition and any rendered subcriteria
182194 * in order.
183195 *
184- * @param initialCondition - may be null if there is no rendered initial condition (as can be the case of
185- * optional conditions like isEqualToWhenPresent)
196+ * @param initialCondition - may not be null. If there is no initial condition, then use the other overload
186197 * @param renderedSubCriteria - a list of previously rendered sub criteria. The sub criteria will all
187198 * have connectors (either an AND or an OR)
188199 * @return a fragment collector whose fragments represent the final calculated list of fragments and parameters.
@@ -223,18 +234,6 @@ private Optional<FragmentCollector> collectSqlFragments(List<RenderedCriterion>
223234 return Optional .of (fc );
224235 }
225236
226- private RenderedCriterion calculateRenderedCriterion (FragmentCollector fragmentCollector ,
227- Function <FragmentCollector , String > fragmentCalculator ) {
228- FragmentAndParameters fragmentAndParameters = FragmentAndParameters
229- .withFragment (fragmentCalculator .apply (fragmentCollector ))
230- .withParameters (fragmentCollector .parameters ())
231- .build ();
232-
233- return new RenderedCriterion .Builder ()
234- .withFragmentAndParameters (fragmentAndParameters )
235- .build ();
236- }
237-
238237 private String calculateFragment (FragmentCollector collector ) {
239238 if (collector .hasMultipleFragments ()) {
240239 return collector .fragments ()
0 commit comments