private static void resetContext(ScriptEngine engine) { ScriptContext context = engine.getContext(); context.removeAttribute("method", ScriptContext.ENGINE_SCOPE); context.removeAttribute("groups", ScriptContext.ENGINE_SCOPE); context.removeAttribute("testngMethod", ScriptContext.ENGINE_SCOPE); } }
context.removeAttribute(COLLECTED_BOUND_VARS_MAP_VARNAME, ScriptContext.ENGINE_SCOPE); localVars.clear();
@Override public boolean deleteBinding(String name) { return context.removeAttribute(name, ScriptContext.ENGINE_SCOPE) != null; }
@Override public Object removeAttribute(String s, int i) { return context.removeAttribute(s, i); }
private void restoreBinding(Map<String, Object> currentEngineBindings, ScriptContext scriptContext, String name) { if (currentEngineBindings.containsKey(name)) { scriptContext.setAttribute(name, currentEngineBindings.get(name), ScriptContext.ENGINE_SCOPE); } else { scriptContext.removeAttribute(name, ScriptContext.ENGINE_SCOPE); } }
@Override public synchronized void delete(String name) { synchronized (context) { int scope = context.getAttributesScope(name); if (scope != -1) { context.removeAttribute(name, scope); } } }
protected void restoreVars ( final ScriptContext context, final Map<String, Object> vars ) { if ( vars == null ) { return; } for ( final Map.Entry<String, Object> entry : vars.entrySet () ) { if ( entry.getValue () == null ) { context.removeAttribute ( entry.getKey (), ScriptContext.ENGINE_SCOPE ); } else { context.setAttribute ( entry.getKey (), entry.getValue (), ScriptContext.ENGINE_SCOPE ); } } }
/** * Removes the mapping from the engine scope. * <p/> * <p>Returns the value to which the map previously associated the key, or * <tt>null</tt> if the map contained no mapping for this key. (A * <tt>null</tt> return can also indicate that the map previously associated * <tt>null</tt> with the specified key if the implementation supports * <tt>null</tt> values.) The map will not contain a mapping for the specified * key once the call returns. * * @param okey key whose mapping is to be removed from the map. * @return previous value associated with specified key, or <tt>null</tt> if * there was no mapping for key. * @throws ClassCastException if the key is of an inappropriate type for this * map (optional). * @throws NullPointerException if the key is <tt>null</tt> and this map does * not permit <tt>null</tt> keys (optional). * @throws UnsupportedOperationException if the <tt>remove</tt> method is not * supported by this map. */ // Why is the compiler complaining about this? //public Object remove( String key ) public Object remove(Object okey) { // This shouldn't be necessary... we don't map Objects, Strings. String key = (String) okey; Object oldValue = context.getAttribute(key, ENGINE_SCOPE); context.removeAttribute(key, ENGINE_SCOPE); return oldValue; }
/** * Removes a named property from the object. * * If the property is not found, no action is taken. * * @param name the name of the property */ public synchronized void delete(String name) { if (isEmpty(name)) { indexedProps.remove(name); } else { synchronized (context) { int scope = context.getAttributesScope(name); if (scope != -1) { context.removeAttribute(name, scope); } } } }
/** * Removes the mapping from the engine scope. * <p/> * <p>Returns the value to which the map previously associated the key, or * <tt>null</tt> if the map contained no mapping for this key. (A * <tt>null</tt> return can also indicate that the map previously associated * <tt>null</tt> with the specified key if the implementation supports * <tt>null</tt> values.) The map will not contain a mapping for the specified * key once the call returns. * * @param okey key whose mapping is to be removed from the map. * @return previous value associated with specified key, or <tt>null</tt> if * there was no mapping for key. * @throws ClassCastException if the key is of an inappropriate type for this * map (optional). * @throws NullPointerException if the key is <tt>null</tt> and this map does * not permit <tt>null</tt> keys (optional). * @throws UnsupportedOperationException if the <tt>remove</tt> method is not * supported by this map. */ // Why is the compiler complaining about this? //public Object remove( String key ) @Override public Object remove(Object key) { int scope = context.getAttributesScope((String) key); if (scope > -1) return context.removeAttribute((String) key, scope); return null; }
@Override public void __delitem__(String key) { int scope = context.getAttributesScope(key); if (scope == -1) throw Py.KeyError(key); context.removeAttribute(key, scope); }
/** * Removes a named property from the object. * * If the property is not found, no action is taken. * * @param name the name of the property */ public synchronized void delete(String name) { if (isEmpty(name)) { indexedProps.remove(name); } else { synchronized (context) { int scope = context.getAttributesScope(name); if (scope != -1) { context.removeAttribute(name, scope); } } } }
/** * Removes a named property from the object. * * If the property is not found, no action is taken. * * @param name the name of the property */ public synchronized void delete(String name) { if (isEmpty(name)) { indexedProps.remove(name); } else { synchronized (context) { int scope = context.getAttributesScope(name); if (scope != -1) { context.removeAttribute(name, scope); } } } }
/** * Removes a named property from the object. * * If the property is not found, no action is taken. * * @param name the name of the property */ @Override public synchronized void delete(String name) { if (isEmpty(name)) { indexedProps.remove(name); } else { synchronized (context) { int scope = context.getAttributesScope(name); if (scope != -1) { context.removeAttribute(name, scope); } } } }
context.removeAttribute(COLLECTED_BOUND_VARS_MAP_VARNAME, ScriptContext.ENGINE_SCOPE); localVars.clear();
ctx.removeAttribute("context", ScriptContext.ENGINE_SCOPE); ctx.removeAttribute("out", ScriptContext.ENGINE_SCOPE);
ctx.removeAttribute("context", ScriptContext.ENGINE_SCOPE); ctx.removeAttribute("out", ScriptContext.ENGINE_SCOPE);
scriptContext.removeAttribute(ScriptEngine.FILENAME, ScriptContext.ENGINE_SCOPE);
ctx.removeAttribute("context", ScriptContext.ENGINE_SCOPE); ctx.removeAttribute("out", ScriptContext.ENGINE_SCOPE);