Interface PooledValue
public interface PooledValue
A Python value evaluated and cached independently in each pooled GraalPy context.
The wrapper borrows a context for each operation and resolves the context-local value before
invoking the supplied function. Prefer typed methods such as executeAsString(Object...)
when the result is consumed immediately, because the underlying context is returned to the pool
before the method returns.
- Since:
- 5.2.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault org.graalvm.polyglot.ValueExecute the context-local value.default booleanexecuteAsBoolean(Object... args) Execute the context-local value and convert the result to a boolean before releasing the context.default StringexecuteAsString(Object... args) Execute the context-local value and convert the result to a string before releasing the context.<T> TExecute a callback with the context-local value.
-
Method Details
-
withValue
Execute a callback with the context-local value.- Type Parameters:
T- The callback result type- Parameters:
callback- The callback receiving the value- Returns:
- The callback result
-
execute
Execute the context-local value.- Parameters:
args- Arguments to pass to the Python value- Returns:
- The polyglot result
-
executeAsString
-
executeAsBoolean
Execute the context-local value and convert the result to a boolean before releasing the context.- Parameters:
args- Arguments to pass to the Python value- Returns:
- The boolean result
-