/** * Get the value of a variable in the local namespace Value will be returned as an instance of the * given Java class. <code>interp.get("foo", Object.class)</code> will return the most appropriate * generic Java object. * * @param name the name of the variable * @param javaclass the class of object to return */ public Object get(String name, Class javaclass) { return Py.tojava(locals.__finditem__(name.intern()), javaclass); }
/** * Set a variable in the local namespace * * @param name the name of the variable * @param value the value to set the variable to */ public void set(String name, PyObject value) { locals.__setitem__(name.intern(), value); }
/** * Get the value of a variable in the local namespace * * @param name the name of the variable */ public PyObject get(String name) { return locals.__finditem__(name.intern()); }
/** * Set a variable in the local namespace * * @param name the name of the variable * @param value the value to set the variable to. Will be automatically converted to an * appropriate Python object. */ public void set(String name, Object value) { locals.__setitem__(name.intern(), Py.java2py(value)); }