Skip to content

Commit

Permalink
MigrateItemWriterWrite should also convert items.stream()
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Aug 26, 2024
1 parent c240371 commit 912d49d
Show file tree
Hide file tree
Showing 2 changed files with 356 additions and 303 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,13 @@ public UpdateListMethodInvocations(String parameterName) {
this.parameterName = parameterName;
}

private static final MethodMatcher COLLECTION_MATCHER = new MethodMatcher("java.util.Collection *(..)", true);
private static final MethodMatcher LIST_MATCHER = new MethodMatcher("java.util.List *(..)", true);

@Override
public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, ExecutionContext ctx) {
J.MethodInvocation mi = super.visitMethodInvocation(method, ctx);
if (LIST_MATCHER.matches(mi) && isParameter(mi.getSelect())) {
if ((COLLECTION_MATCHER.matches(mi) || LIST_MATCHER.matches(mi)) && isParameter(mi.getSelect())) {
assert mi.getPadding().getSelect() != null;
// No need to take care of typing here, since it's going to be printed and parsed on the JavaTemplate later on.
mi = mi.withSelect(newGetItemsMethodInvocation(mi.getPadding().getSelect()));
Expand Down
Loading

0 comments on commit 912d49d

Please sign in to comment.