Example usage for javax.script Bindings forEach

List of usage examples for javax.script Bindings forEach

Introduction

In this page you can find the example usage for javax.script Bindings forEach.

Prototype

default void forEach(BiConsumer<? super K, ? super V> action) 

Source Link

Document

Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.

Usage

From source file:org.wso2.carbon.identity.application.authentication.framework.config.model.graph.JsGraphBuilderFactory.java

public static void persistCurrentContext(AuthenticationContext context, ScriptEngine engine) {

    Bindings engineBindings = engine.getBindings(ScriptContext.ENGINE_SCOPE);
    Map<String, Object> persistableMap = new HashMap<>();
    engineBindings.forEach((key, value) -> persistableMap.put(key, FrameworkUtils.toJsSerializable(value)));
    context.setProperty(JS_BINDING_CURRENT_CONTEXT, persistableMap);
}