Package io.deephaven.integrations.python
Class JavaLambdaFactory
java.lang.Object
io.deephaven.integrations.python.JavaLambdaFactory
Tool to wrap Python Callables into Java functional interfaces. Useful for Java-aware Python code to implement Java
functional interfaces to pass callbacks/handlers/etc to Python-oblivious Java APIs.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
JavaLambdaFactory
public JavaLambdaFactory()
-
-
Method Details
-
create
public static <T> T create(Class<T> samInterface, org.jpy.PyObject callable, @Nullable Class<?> coerceToType) Wraps a python callable in a java functional interface, with an optional extra step to coerce a returned value to handle Deephaven nulls.- Type Parameters:
T
- the type of the lambda to return- Parameters:
samInterface
- the Java interface to wrap the callable in. If this has more than one abstract method, an exception will be thrown.callable
- The Python Callable to wrapcoerceToType
- An optional, expected return type for the Callable to return.- Returns:
- a Java functional interface implementation
-