本文整理了Java中org.jruby.RubyModule.getInstanceVariable
方法的一些代码示例,展示了RubyModule.getInstanceVariable
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyModule.getInstanceVariable
方法的具体详情如下:
包路径:org.jruby.RubyModule
类名称:RubyModule
方法名:getInstanceVariable
暂无
代码示例来源:origin: bazelbuild/bazel
@JRubyMethod(meta = true, name = "descriptor")
public static IRubyObject getDescriptor(ThreadContext context, IRubyObject recv) {
return ((RubyModule) recv).getInstanceVariable(Utils.DESCRIPTOR_INSTANCE_VAR);
}
}
代码示例来源:origin: bazelbuild/bazel
protected static void validateTypeClass(ThreadContext context, Descriptors.FieldDescriptor.Type type, IRubyObject value) {
Ruby runtime = context.runtime;
if (!(value instanceof RubyModule)) {
throw runtime.newArgumentError("TypeClass has incorrect type");
}
RubyModule klass = (RubyModule) value;
IRubyObject descriptor = klass.getInstanceVariable(DESCRIPTOR_INSTANCE_VAR);
if (descriptor.isNil()) {
throw runtime.newArgumentError("Type class has no descriptor. Please pass a " +
"class or enum as returned by the DescriptorPool.");
}
if (type == Descriptors.FieldDescriptor.Type.MESSAGE) {
if (! (descriptor instanceof RubyDescriptor)) {
throw runtime.newArgumentError("Descriptor has an incorrect type");
}
} else if (type == Descriptors.FieldDescriptor.Type.ENUM) {
if (! (descriptor instanceof RubyEnumDescriptor)) {
throw runtime.newArgumentError("Descriptor has an incorrect type");
}
}
}
代码示例来源:origin: bazelbuild/bazel
if (value instanceof RubySymbol) {
Descriptors.EnumDescriptor enumDescriptor =
((RubyEnumDescriptor) typeClass.getInstanceVariable(DESCRIPTOR_INSTANCE_VAR)).getDescriptor();
val = enumDescriptor.findValueByName(value.asJavaString());
if (val == null)
代码示例来源:origin: org.jruby/jruby-complete
/**
* Returns the (reified or proxied) Java class if the passed Ruby module/class has one.
* @param context
* @param type
* @return Java proxy class, Java reified class or nil
*/
public static IRubyObject java_class(final ThreadContext context, final RubyModule type) {
IRubyObject java_class = type.getInstanceVariable("@java_class");
if ( java_class == null ) { // || java_class.isNil()
if ( type.respondsTo("java_class") ) { // NOTE: quite bad since built-in Ruby classes will return
// a Ruby Java proxy for java.lang.Class while Java proxies will return a JavaClass instance !
java_class = Helpers.invoke(context, type, "java_class");
}
else java_class = context.nil; // we return != null (just like callMethod would)
}
return java_class;
}
代码示例来源:origin: org.jruby/jruby-core
/**
* Returns the (reified or proxied) Java class if the passed Ruby module/class has one.
* @param context
* @param type
* @return Java proxy class, Java reified class or nil
*/
public static IRubyObject java_class(final ThreadContext context, final RubyModule type) {
IRubyObject java_class = type.getInstanceVariable("@java_class");
if ( java_class == null ) { // || java_class.isNil()
if ( type.respondsTo("java_class") ) { // NOTE: quite bad since built-in Ruby classes will return
// a Ruby Java proxy for java.lang.Class while Java proxies will return a JavaClass instance !
java_class = Helpers.invoke(context, type, "java_class");
}
else java_class = context.nil; // we return != null (just like callMethod would)
}
return java_class;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private static RubyModule getProxyOrPackageUnderPackage(ThreadContext context, final Ruby runtime,
RubyModule parentPackage, String sym) {
IRubyObject packageNameObj = parentPackage.getInstanceVariable("@package_name");
if (packageNameObj == null) {
throw runtime.newArgumentError("invalid package module");
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private static RubyModule getProxyOrPackageUnderPackage(ThreadContext context, final Ruby runtime,
RubyModule parentPackage, String sym) {
IRubyObject packageNameObj = parentPackage.getInstanceVariable("@package_name");
if (packageNameObj == null) {
throw runtime.newArgumentError("invalid package module");
内容来源于网络,如有侵权,请联系作者删除!