Package javax.script

Examples of javax.script.Bindings.keySet()


    try {
      Map<String, Object> map = new HashMap<String, Object>();
      for (Iterator it = context.getScopes().iterator(); it.hasNext(); ) {
        int scope = ((Integer)it.next()).intValue();
        Bindings bindings = context.getBindings(scope);
        Set keys = bindings.keySet();
       
        for(Object key : keys) {
          map.put((String)key, bindings.get(key));
        }
        }
View Full Code Here


                    for(BindingsValuesProvider bvp : bindingsValuesProviders) {
                        log.debug("Adding Bindings provided by {}", bvp);
                        bvp.addBindings(b);
                    }
                }
                log.debug("All Bindings added: {}", b.keySet());

                final Object value = engine.eval(expression, b);
                if(value!=null && "true".equals(value.toString().toLowerCase())) {
                    resultLog.debug("Expression [{}] evaluates to true as expected", expression);
                } else {
View Full Code Here

    private Map<String, Object> getContextMatches(String start) {
        Map<String, Object> found = new HashMap<String, Object>();
        if (context != null) {
            for (Integer scope : context.getScopes()) {
                Bindings bindings = context.getBindings(scope);
                for (String var : bindings.keySet()) {
                    if (var.startsWith(start)) {
                        found.put(var, bindings.get(var));
                    }
                }
            }
View Full Code Here

    private Map<String, Object> getContextMatches(String start, Class<?> typeFilter) {
        Map<String, Object> found = new HashMap<String, Object>();
        if (context != null) {
            for (int scope : context.getScopes()) {
                Bindings bindings = context.getBindings(scope);
                for (String var : bindings.keySet()) {
                    if (var.startsWith(start)) {

                        if ((bindings.get(var) != null && typeFilter.isAssignableFrom(bindings.get(var).getClass()))
                            || recomplete == 3) {
                            found.put(var, bindings.get(var));
View Full Code Here

        synchronized (context) {
            for (int scope : context.getScopes()) {
                Bindings bindings = context.getBindings(scope);
                if (bindings != null) {
                    list.ensureCapacity(bindings.size());
                    for (String key : bindings.keySet()) {
                        list.add(key);
                    }
                }
            }
        }
View Full Code Here

        }

        private ArrayList<DebugVariable> getPythonVariablesDump() {
            Bindings globalContext = engine.getBindings(ScriptContext.ENGINE_SCOPE);
            ArrayList<DebugVariable> debugVariables = new ArrayList<DebugVariable>();
            for (String variableName : new TreeSet<String>(globalContext.keySet())) {
                Object variableValue = globalContext.get(variableName);
                if (!variableName.startsWith("__") &&
                        !(variableValue instanceof PySystemState) &&
                        !(variableValue instanceof com.sun.script.jython.JythonScriptEngine) &&
                        !(variableValue instanceof javax.script.SimpleScriptContext) &&
View Full Code Here

    }

    static void preEval(ScriptingContainer container, ScriptContext context) {
        Object receiver = getReceiverObject(context);
        Bindings bindings = context.getBindings(ScriptContext.ENGINE_SCOPE);
        Set<String> keys = bindings.keySet();
        for (String key : keys) {
            Object value = bindings.get(key);
            Utils.put(container, receiver, key, value, context);
        }
       
View Full Code Here

        container.setErrorWriter(context.getErrorWriter());

        // if key of globalMap exists in engineMap, this key-value pair should be skipped.
        bindings = context.getBindings(ScriptContext.GLOBAL_SCOPE);
        if (bindings == null) return;
        keys = bindings.keySet();
        for (String key : keys) {
            if (container.getVarMap().containsKey(key)) continue;
            Object value = bindings.get(key);
            put(container, receiver, key, value, context);
        }
View Full Code Here

    static void postEval(ScriptingContainer container, ScriptContext context) {
        if (context == null) return;
        Object receiver = getReceiverObject(context);
       
        Bindings engineMap = context.getBindings(ScriptContext.ENGINE_SCOPE);
        int size = engineMap.keySet().size();
        String[] names = engineMap.keySet().toArray(new String[size]);
        for (int i=0; i<names.length; i++) {
            if (shouldLVarBeDeleted(container, names[i])) {
                engineMap.remove(names[i]);
            }
View Full Code Here

        if (context == null) return;
        Object receiver = getReceiverObject(context);
       
        Bindings engineMap = context.getBindings(ScriptContext.ENGINE_SCOPE);
        int size = engineMap.keySet().size();
        String[] names = engineMap.keySet().toArray(new String[size]);
        for (int i=0; i<names.length; i++) {
            if (shouldLVarBeDeleted(container, names[i])) {
                engineMap.remove(names[i]);
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.