MCPcopy Index your code
hub / github.com/apache/groovy / FunctionClosure

Class FunctionClosure

src/main/java/org/apache/groovy/util/Closures.java:168–195  ·  view source on GitHub ↗

Hybrid one-argument function that is both a Closure and a Function. @since 6.0.0

Source from the content-addressed store, hash-verified

166 * @since 6.0.0
167 */
168 public static class FunctionClosure<T, R> extends Closure<R> implements Function<T, R> {
169 @Serial private static final long serialVersionUID = 1L;
170 private final Function<T, R> delegate;
171
172 FunctionClosure(Function<T, R> delegate) {
173 super(null, null);
174 this.delegate = delegate;
175 this.maximumNumberOfParameters = 1;
176 this.parameterTypes = new Class<?>[]{Object.class};
177 }
178
179 @Override
180 public R apply(T t) {
181 return delegate.apply(t);
182 }
183
184 @Override
185 @SuppressWarnings("unchecked")
186 public R call(Object arg) {
187 return apply((T) arg);
188 }
189
190 @Override
191 @SuppressWarnings("unchecked")
192 public R call(Object... args) {
193 return apply((T) args[0]);
194 }
195 }
196
197 /**
198 * Hybrid one-argument function that is both a {@link Closure} and a

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…