public IRubyObject allocate(Ruby runtime, RubyClass klazz) { return new MapJavaProxy(runtime, klazz); } });
public IRubyObject allocate(Ruby runtime, RubyClass klazz) { return new MapJavaProxy(runtime, klazz); } });
public MapJavaProxy allocate(Ruby runtime, RubyClass klazz) { return new MapJavaProxy(runtime, klazz); } };
public MapJavaProxy allocate(Ruby runtime, RubyClass klazz) { return new MapJavaProxy(runtime, klazz); } };
@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; } }
@Override public IRubyObject dup() { try { MapJavaProxy proxy = new MapJavaProxy(getRuntime(), metaClass); Map newMap = (Map)getObject().getClass().newInstance(); newMap.putAll((Map)getObject()); proxy.setObject(newMap); return proxy; } catch (InstantiationException ex) { throw getRuntime().newNotImplementedError("can't dup Map of type " + getObject().getClass().getName()); } catch (IllegalAccessException ex) { throw getRuntime().newNotImplementedError("can't dup Map of type " + getObject().getClass().getName()); } }
@Override public IRubyObject rbClone() { try { MapJavaProxy proxy = new MapJavaProxy(getRuntime(), metaClass); Map newMap = (Map)getObject().getClass().newInstance(); newMap.putAll((Map)getObject()); proxy.setObject(newMap); return proxy; } catch (InstantiationException ex) { throw getRuntime().newNotImplementedError("can't clone Map of type " + getObject().getClass().getName()); } catch (IllegalAccessException ex) { throw getRuntime().newNotImplementedError("can't clone Map of type " + getObject().getClass().getName()); } }
@Override public IRubyObject rbClone() { try { MapJavaProxy proxy = new MapJavaProxy(getRuntime(), metaClass); Map newMap = (Map)getObject().getClass().newInstance(); newMap.putAll((Map)getObject()); proxy.setObject(newMap); return proxy; } catch (InstantiationException ex) { throw getRuntime().newNotImplementedError("can't clone Map of type " + getObject().getClass().getName()); } catch (IllegalAccessException ex) { throw getRuntime().newNotImplementedError("can't clone Map of type " + getObject().getClass().getName()); } }
@Override public IRubyObject dup() { try { MapJavaProxy proxy = new MapJavaProxy(getRuntime(), metaClass); Map newMap = (Map)getObject().getClass().newInstance(); newMap.putAll((Map)getObject()); proxy.setObject(newMap); return proxy; } catch (InstantiationException ex) { throw getRuntime().newNotImplementedError("can't dup Map of type " + getObject().getClass().getName()); } catch (IllegalAccessException ex) { throw getRuntime().newNotImplementedError("can't dup Map of type " + getObject().getClass().getName()); } }
public void load(Ruby runtime, boolean wrap) throws IOException { createJavaModule(runtime); RubyModule jpmt = runtime.defineModule("JavaPackageModuleTemplate"); jpmt.getSingletonClass().setSuperClass(new BlankSlateWrapper(runtime, jpmt.getMetaClass().getSuperClass(), runtime.getKernel())); runtime.getLoadService().require("jruby/java"); // rewite ArrayJavaProxy superclass to point at Object, so it inherits Object behaviors RubyClass ajp = runtime.getClass("ArrayJavaProxy"); ajp.setSuperClass(runtime.getJavaSupport().getObjectJavaClass().getProxyClass()); ajp.includeModule(runtime.getEnumerable()); RubyClassPathVariable.createClassPathVariable(runtime); runtime.setJavaProxyClassFactory(JavaProxyClassFactory.createFactory()); // modify ENV_JAVA to be a read/write version Map systemProps = new SystemPropertiesMap(); runtime.getObject().setConstantQuiet( "ENV_JAVA", new MapJavaProxy( runtime, (RubyClass)Java.getProxyClass(runtime, SystemPropertiesMap.class), systemProps)); }
public void load(Ruby runtime, boolean wrap) throws IOException { createJavaModule(runtime); RubyModule jpmt = runtime.defineModule("JavaPackageModuleTemplate"); jpmt.getSingletonClass().setSuperClass(new BlankSlateWrapper(runtime, jpmt.getMetaClass().getSuperClass(), runtime.getKernel())); runtime.getLoadService().require("jruby/java"); // rewite ArrayJavaProxy superclass to point at Object, so it inherits Object behaviors RubyClass ajp = runtime.getClass("ArrayJavaProxy"); ajp.setSuperClass(runtime.getJavaSupport().getObjectJavaClass().getProxyClass()); ajp.includeModule(runtime.getEnumerable()); RubyClassPathVariable.createClassPathVariable(runtime); runtime.setJavaProxyClassFactory(JavaProxyClassFactory.createFactory()); // modify ENV_JAVA to be a read/write version Map systemProps = new SystemPropertiesMap(); runtime.getObject().setConstantQuiet( "ENV_JAVA", new MapJavaProxy( runtime, (RubyClass)Java.getProxyClass(runtime, SystemPropertiesMap.class), systemProps)); }
@Override public void load(Ruby runtime, boolean wrap) { final RubyModule Java = createJavaModule(runtime); JavaPackage.createJavaPackageClass(runtime, Java); org.jruby.javasupport.ext.Kernel.define(runtime); org.jruby.javasupport.ext.JavaLang.define(runtime); org.jruby.javasupport.ext.JavaLangReflect.define(runtime); org.jruby.javasupport.ext.JavaUtil.define(runtime); org.jruby.javasupport.ext.JavaUtilRegex.define(runtime); org.jruby.javasupport.ext.JavaIo.define(runtime); org.jruby.javasupport.ext.JavaNet.define(runtime); // load Ruby parts of the 'java' library runtime.getLoadService().load("jruby/java.rb", false); // rewire ArrayJavaProxy superclass to point at Object, so it inherits Object behaviors final RubyClass ArrayJavaProxy = runtime.getClass("ArrayJavaProxy"); ArrayJavaProxy.setSuperClass(runtime.getJavaSupport().getObjectJavaClass().getProxyClass()); ArrayJavaProxy.includeModule(runtime.getEnumerable()); RubyClassPathVariable.createClassPathVariable(runtime); runtime.setJavaProxyClassFactory(JavaProxyClassFactory.createFactory()); // modify ENV_JAVA to be a read/write version final Map systemProperties = new SystemPropertiesMap(); RubyClass proxyClass = (RubyClass) getProxyClass(runtime, SystemPropertiesMap.class); runtime.getObject().setConstantQuiet("ENV_JAVA", new MapJavaProxy(runtime, proxyClass, systemProperties)); }
@Override public void load(Ruby runtime, boolean wrap) { final RubyModule Java = createJavaModule(runtime); JavaPackage.createJavaPackageClass(runtime, Java); org.jruby.javasupport.ext.Kernel.define(runtime); org.jruby.javasupport.ext.JavaLang.define(runtime); org.jruby.javasupport.ext.JavaLangReflect.define(runtime); org.jruby.javasupport.ext.JavaUtil.define(runtime); org.jruby.javasupport.ext.JavaUtilRegex.define(runtime); org.jruby.javasupport.ext.JavaIo.define(runtime); org.jruby.javasupport.ext.JavaNet.define(runtime); // load Ruby parts of the 'java' library runtime.getLoadService().load("jruby/java.rb", false); // rewire ArrayJavaProxy superclass to point at Object, so it inherits Object behaviors final RubyClass ArrayJavaProxy = runtime.getClass("ArrayJavaProxy"); ArrayJavaProxy.setSuperClass(runtime.getJavaSupport().getObjectJavaClass().getProxyClass()); ArrayJavaProxy.includeModule(runtime.getEnumerable()); RubyClassPathVariable.createClassPathVariable(runtime); runtime.setJavaProxyClassFactory(JavaProxyClassFactory.createFactory()); // modify ENV_JAVA to be a read/write version final Map systemProperties = new SystemPropertiesMap(); RubyClass proxyClass = (RubyClass) getProxyClass(runtime, SystemPropertiesMap.class); runtime.getObject().setConstantQuiet("ENV_JAVA", new MapJavaProxy(runtime, proxyClass, systemProperties)); }