org.jruby.Ruby.setJavaProxyClassFactory()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.jruby.Ruby.setJavaProxyClassFactory方法的一些代码示例,展示了Ruby.setJavaProxyClassFactory的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.setJavaProxyClassFactory方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:setJavaProxyClassFactory

Ruby.setJavaProxyClassFactory介绍

暂无

代码示例

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

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));
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

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));
}

代码示例来源:origin: org.jruby/jruby-complete

@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));
}

代码示例来源:origin: org.jruby/jruby-core

@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));
}

相关文章

Ruby类方法