private Map mapDelegate() { return receiver.getMapObject(); }
private Map mapDelegate() { return receiver.getMapObject(); }
@SuppressWarnings("unchecked") private MapJavaProxy dupImpl(final String method) { final Map map = getMapObject(); try { Map newMap = map.getClass().newInstance(); newMap.putAll(map); MapJavaProxy proxy = new MapJavaProxy(getRuntime(), metaClass); proxy.setObject(newMap); return proxy; } catch (InstantiationException|IllegalAccessException ex) { final RaiseException e = getRuntime().newNotImplementedError("can't "+ method +" Map of type " + getObject().getClass().getName()); e.initCause(ex); throw e; } }
@SuppressWarnings("unchecked") private MapJavaProxy dupImpl(final String method) { final Map map = getMapObject(); try { Map newMap = map.getClass().newInstance(); newMap.putAll(map); MapJavaProxy proxy = new MapJavaProxy(getRuntime(), metaClass); proxy.setObject(newMap); return proxy; } catch (InstantiationException|IllegalAccessException ex) { final RaiseException e = getRuntime().newNotImplementedError("can't "+ method +" Map of type " + getObject().getClass().getName()); e.initCause(ex); throw e; } }
private RubyHashMap getOrCreateRubyHashMap() { if (wrappedMap == null) { wrappedMap = new RubyHashMap(getRuntime(), this); } // (JavaProxy)recv).getObject() might raise exception when // wrong number of args are given to the constructor. IRubyObject oldExc = getRuntime().getGlobalVariables().get("$!"); // Save $! try { wrappedMap.setSize( getMapObject().size() ); } catch (RaiseException e) { wrappedMap.setSize(0); getRuntime().getGlobalVariables().set("$!", oldExc); // Restore $! } return wrappedMap; }
private RubyHashMap getOrCreateRubyHashMap() { if (wrappedMap == null) { wrappedMap = new RubyHashMap(getRuntime(), this); } // (JavaProxy)recv).getObject() might raise exception when // wrong number of args are given to the constructor. IRubyObject oldExc = getRuntime().getGlobalVariables().get("$!"); // Save $! try { wrappedMap.setSize( getMapObject().size() ); } catch (RaiseException e) { wrappedMap.setSize(0); getRuntime().getGlobalVariables().set("$!", oldExc); // Restore $! } return wrappedMap; }