From 61ae36350c5f99200e81311f394e3a007ea694df Mon Sep 17 00:00:00 2001 From: Jan Lukavsky Date: Mon, 9 Oct 2023 15:39:26 +0200 Subject: [PATCH] [proxima-tools] add type hints to WindowedStream --- .../proxima/tools/groovy/WindowedStream.java | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/tools/src/main/java/cz/o2/proxima/tools/groovy/WindowedStream.java b/tools/src/main/java/cz/o2/proxima/tools/groovy/WindowedStream.java index cb75b4d42..69355c0d7 100644 --- a/tools/src/main/java/cz/o2/proxima/tools/groovy/WindowedStream.java +++ b/tools/src/main/java/cz/o2/proxima/tools/groovy/WindowedStream.java @@ -541,36 +541,51 @@ WindowedStream distinct( // overrides of Stream methods with fixed return types @Override - default WindowedStream flatMap(Closure> mapper) { + default WindowedStream flatMap( + @ClosureParams(value = FromString.class, options = "T") Closure> mapper) { return flatMap(null, mapper); } @Override - WindowedStream flatMap(@Nullable String name, Closure> mapper); + WindowedStream flatMap( + @Nullable String name, + @ClosureParams(value = FromString.class, options = "T") Closure> mapper); @Override - default WindowedStream map(Closure mapper) { + default WindowedStream map( + @ClosureParams(value = FromString.class, options = "T") Closure mapper) { + return map(null, mapper); } @Override - WindowedStream map(@Nullable String name, Closure mapper); + WindowedStream map( + @Nullable String name, + @ClosureParams(value = FromString.class, options = "T") Closure mapper); @Override - default WindowedStream filter(Closure predicate) { + default WindowedStream filter( + @ClosureParams(value = FromString.class, options = "T") Closure predicate) { + return filter(null, predicate); } @Override - WindowedStream filter(@Nullable String name, Closure predicate); + WindowedStream filter( + @Nullable String name, + @ClosureParams(value = FromString.class, options = "T") Closure predicate); @Override - default WindowedStream assignEventTime(Closure assigner) { + default WindowedStream assignEventTime( + @ClosureParams(value = FromString.class, options = "T") Closure assigner) { + return assignEventTime(null, assigner); } @Override - WindowedStream assignEventTime(@Nullable String name, Closure assigner); + WindowedStream assignEventTime( + @Nullable String name, + @ClosureParams(value = FromString.class, options = "T") Closure assigner); @Override default WindowedStream> withWindow() {