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

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

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

Ruby.getObject介绍

暂无

代码示例

代码示例来源:origin: bazelbuild/bazel

public static void createRubyFileDescriptor(Ruby runtime) {
  RubyModule mProtobuf = runtime.getClassFromPath("Google::Protobuf");
  RubyClass cFieldDescriptor = mProtobuf.defineClassUnder("FieldDescriptor", runtime.getObject(), new ObjectAllocator() {
    @Override
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      return new RubyFieldDescriptor(runtime, klazz);
    }
  });
  cFieldDescriptor.defineAnnotatedMethods(RubyFieldDescriptor.class);
}

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

public static RubyClass createArrayJavaProxyCreator(ThreadContext context) {
  Ruby runtime = context.runtime;
  RubyClass arrayJavaProxyCreator = runtime.defineClass("ArrayJavaProxyCreator", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
  arrayJavaProxyCreator.defineAnnotatedMethods(ArrayJavaProxyCreator.class);
  return arrayJavaProxyCreator;
}

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

public static RubyClass createJRubyObjectInputStream(Ruby runtime) {
  RubyClass result = runtime.defineClass("JRubyObjectInputStream",runtime.getObject(), ALLOCATOR);
  result.defineAnnotatedMethods(JRubyObjectInputStream.class);
  return result;
}

代码示例来源:origin: bazelbuild/bazel

public static void createRubyEnumBuilderContext(Ruby runtime) {
  RubyModule protobuf = runtime.getClassFromPath("Google::Protobuf");
  RubyClass cMessageBuilderContext = protobuf.defineClassUnder("EnumBuilderContext", runtime.getObject(), new ObjectAllocator() {
    @Override
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      return new RubyEnumBuilderContext(runtime, klazz);
    }
  });
  cMessageBuilderContext.defineAnnotatedMethods(RubyEnumBuilderContext.class);
}

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

public static void createTracePointClass(Ruby runtime) {
  RubyClass tracePoint = runtime.defineClass("TracePoint", runtime.getObject(), new ObjectAllocator() {
    @Override
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      return new TracePoint(runtime, klazz);
    }
  });
  
  tracePoint.defineAnnotatedMethods(TracePoint.class);
}

代码示例来源:origin: bazelbuild/bazel

public static void createRubyMessageBuilderContext(Ruby runtime) {
  RubyModule protobuf = runtime.getClassFromPath("Google::Protobuf");
  RubyClass cMessageBuilderContext = protobuf.defineClassUnder("MessageBuilderContext", runtime.getObject(), new ObjectAllocator() {
    @Override
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      return new RubyMessageBuilderContext(runtime, klazz);
    }
  });
  cMessageBuilderContext.defineAnnotatedMethods(RubyMessageBuilderContext.class);
}

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

public static RubyClass createArrayJavaProxyCreator(ThreadContext context) {
  Ruby runtime = context.runtime;
  RubyClass arrayJavaProxyCreator = runtime.defineClass("ArrayJavaProxyCreator", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
  arrayJavaProxyCreator.defineAnnotatedMethods(ArrayJavaProxyCreator.class);
  return arrayJavaProxyCreator;
}

代码示例来源:origin: bazelbuild/bazel

public static void createRubyBuilder(Ruby runtime) {
  RubyModule protobuf = runtime.getClassFromPath("Google::Protobuf");
  RubyClass cBuilder = protobuf.defineClassUnder("Builder", runtime.getObject(), new ObjectAllocator() {
    @Override
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      return new RubyBuilder(runtime, klazz);
    }
  });
  cBuilder.defineAnnotatedMethods(RubyBuilder.class);
}

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

public void load(final Ruby runtime, boolean wrap) {
    RubyClass cFiber = runtime.defineClass("Fiber", runtime.getObject(), new ObjectAllocator() {
      public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
        return new ThreadFiber(runtime, klazz);
      }
    });

    cFiber.defineAnnotatedMethods(ThreadFiber.class);
  }
}

代码示例来源:origin: bazelbuild/bazel

public static void createRubyOneofBuilderContext(Ruby runtime) {
  RubyModule protobuf = runtime.getClassFromPath("Google::Protobuf");
  RubyModule internal = protobuf.defineModuleUnder("Internal");
  RubyClass cRubyOneofBuidlerContext = internal.defineClassUnder("OneofBuilderContext", runtime.getObject(), new ObjectAllocator() {
    @Override
    public IRubyObject allocate(Ruby ruby, RubyClass rubyClass) {
      return new RubyOneofBuilderContext(ruby, rubyClass);
    }
  });
  cRubyOneofBuidlerContext.defineAnnotatedMethods(RubyOneofBuilderContext.class);
}

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

public static void init(Ruby ruby) {
  RubyClass mm = ruby.defineClass("MethodMissing", ruby.getObject(), new ObjectAllocator() {
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      return new MethodMissing(runtime, klazz);
    }
  });
  mm.defineAnnotatedMethods(MethodMissing.class);
}

代码示例来源:origin: bazelbuild/bazel

public static void createRubyDescriptor(Ruby runtime) {
  RubyModule protobuf = runtime.getClassFromPath("Google::Protobuf");
  RubyClass cDescriptor = protobuf.defineClassUnder("Descriptor", runtime.getObject(), new ObjectAllocator() {
    @Override
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      return new RubyDescriptor(runtime, klazz);
    }
  });
  cDescriptor.includeModule(runtime.getEnumerable());
  cDescriptor.defineAnnotatedMethods(RubyDescriptor.class);
}

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

public static void createTracePointClass(Ruby runtime) {
  RubyClass tracePoint = runtime.defineClass("TracePoint", runtime.getObject(), new ObjectAllocator() {
    @Override
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      return new TracePoint(runtime, klazz);
    }
  });
  
  tracePoint.defineAnnotatedMethods(TracePoint.class);
}

代码示例来源:origin: bazelbuild/bazel

public static void createRubyEnumDescriptor(Ruby runtime) {
  RubyModule mProtobuf = runtime.getClassFromPath("Google::Protobuf");
  RubyClass cEnumDescriptor = mProtobuf.defineClassUnder("EnumDescriptor", runtime.getObject(), new ObjectAllocator() {
    @Override
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      return new RubyEnumDescriptor(runtime, klazz);
    }
  });
  cEnumDescriptor.includeModule(runtime.getEnumerable());
  cEnumDescriptor.defineAnnotatedMethods(RubyEnumDescriptor.class);
}

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

public static RubyClass createJRubyObjectInputStream(Ruby runtime) {
RubyClass result = runtime.defineClass("JRubyObjectInputStream",runtime.getObject(),JROIS_ALLOCATOR);
result.defineAnnotatedMethods(JRubyObjectInputStream.class);
return result;
}

代码示例来源:origin: bazelbuild/bazel

public static void createRubyDescriptorPool(Ruby runtime) {
  RubyModule protobuf = runtime.getClassFromPath("Google::Protobuf");
  RubyClass cDescriptorPool = protobuf.defineClassUnder("DescriptorPool", runtime.getObject(), new ObjectAllocator() {
    @Override
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      return new RubyDescriptorPool(runtime, klazz);
    }
  });
  cDescriptorPool.defineAnnotatedMethods(RubyDescriptorPool.class);
  descriptorPool = (RubyDescriptorPool) cDescriptorPool.newInstance(runtime.getCurrentContext(), Block.NULL_BLOCK);
}

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

public static void createTracePointClass(Ruby runtime) {
  RubyClass tracePoint = runtime.defineClass("TracePoint", runtime.getObject(), new ObjectAllocator() {
    @Override
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      return new TracePoint(runtime, klazz);
    }
  });
  
  tracePoint.defineAnnotatedMethods(TracePoint.class);
}

代码示例来源:origin: bazelbuild/bazel

public static void createRubyOneofDescriptor(Ruby runtime) {
  RubyModule protobuf = runtime.getClassFromPath("Google::Protobuf");
  RubyClass cRubyOneofDescriptor = protobuf.defineClassUnder("OneofDescriptor", runtime.getObject(), new ObjectAllocator() {
    @Override
    public IRubyObject allocate(Ruby ruby, RubyClass rubyClass) {
      return new RubyOneofDescriptor(ruby, rubyClass);
    }
  });
  cRubyOneofDescriptor.defineAnnotatedMethods(RubyOneofDescriptor.class);
  cRubyOneofDescriptor.includeModule(runtime.getEnumerable());
}

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

public static RubyClass createJRubyObjectInputStream(Ruby runtime) {
RubyClass result = runtime.defineClass("JRubyObjectInputStream",runtime.getObject(),JROIS_ALLOCATOR);
result.defineAnnotatedMethods(JRubyObjectInputStream.class);
return result;
}

代码示例来源:origin: bazelbuild/bazel

public static void createRubyRepeatedField(Ruby runtime) {
  RubyModule mProtobuf = runtime.getClassFromPath("Google::Protobuf");
  RubyClass cRepeatedField = mProtobuf.defineClassUnder("RepeatedField", runtime.getObject(),
      new ObjectAllocator() {
        @Override
        public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
          return new RubyRepeatedField(runtime, klazz);
        }
      });
  cRepeatedField.defineAnnotatedMethods(RubyRepeatedField.class);
  cRepeatedField.includeModule(runtime.getEnumerable());
}

相关文章

微信公众号

最新文章

更多

Ruby类方法