/** * 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 * @return the value of the variable as the given class, or null if that name isn't assigned */ public <T> T get(String name, Class<T> javaclass) { PyObject val = locals.__finditem__(name.intern()); if (val == null) { return null; } return Py.tojava(val, javaclass); }
/** * 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); }