private Bindings createBindings ( Entity entity , int depth ) { Bindings bindings = new SimpleBindings ( ) ; JSObject global = ( JSObject ) magmaBindings . get ( "nashorn.global" ) ; JSObject magmaScript = ( JSObject ) global . getMember ( KEY_MAGMA_SCRIPT ) ; JSObject dollarFunction = ( JSObject ) magmaScript . getMember ( KEY_DOLLAR ) ; JSObject bindFunction = ( JSObject ) dollarFunction . getMember ( BIND ) ; Object boundDollar = bindFunction . call ( dollarFunction , toScriptEngineValueMap ( entity , depth ) ) ; bindings . put ( KEY_DOLLAR , boundDollar ) ; bindings . put ( KEY_NEW_VALUE , magmaScript . getMember ( KEY_NEW_VALUE ) ) ; bindings . put ( KEY_IS_NULL , magmaScript . getMember ( KEY_IS_NULL ) ) ; return bindings ; }
Creates magmascript bindings for a given Entity .