本文整理了Java中org.jruby.Ruby.getNilClass
方法的一些代码示例,展示了Ruby.getNilClass
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getNilClass
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getNilClass
暂无
代码示例来源:origin: bazelbuild/bazel
private RubyRepeatedField repeatedFieldForFieldDescriptor(ThreadContext context,
Descriptors.FieldDescriptor fieldDescriptor) {
IRubyObject typeClass = context.runtime.getNilClass();
IRubyObject descriptor = getDescriptorForField(context, fieldDescriptor);
Descriptors.FieldDescriptor.Type type = fieldDescriptor.getType();
if (type == Descriptors.FieldDescriptor.Type.MESSAGE) {
typeClass = ((RubyDescriptor) descriptor).msgclass(context);
} else if (type == Descriptors.FieldDescriptor.Type.ENUM) {
typeClass = ((RubyEnumDescriptor) descriptor).enummodule(context);
}
return new RubyRepeatedField(context.runtime, cRepeatedField, type, typeClass);
}
代码示例来源:origin: bazelbuild/bazel
initValueArg = 3;
} else {
this.valueTypeClass = context.runtime.getNilClass();
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public RubyNil(Ruby runtime) {
super(runtime, runtime.getNilClass(), false);
flags |= NIL_F | FALSE_F;
if (RubyInstanceConfig.CONSISTENT_HASHING_ENABLED) {
// default to a fixed value
this.hashCode = 34;
} else {
// save the object id based hash code;
this.hashCode = System.identityHashCode(this);
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public RubyNil(Ruby runtime) {
super(runtime, runtime.getNilClass(), false);
flags |= NIL_F | FALSE_F;
if (RubyInstanceConfig.CONSISTENT_HASHING_ENABLED) {
// default to a fixed value
this.hashCode = 34;
} else {
// save the object id based hash code;
this.hashCode = System.identityHashCode(this);
}
}
代码示例来源:origin: org.jruby/jruby-complete
public RubyNil(Ruby runtime) {
super(runtime, runtime.getNilClass(), false);
flags |= NIL_F | FALSE_F | FROZEN_F;
if (RubyInstanceConfig.CONSISTENT_HASHING_ENABLED) {
// default to a fixed value
this.hashCode = 34;
} else {
// save the object id based hash code;
this.hashCode = System.identityHashCode(this);
}
constant = OptoFactory.newConstantWrapper(IRubyObject.class, this);
}
代码示例来源:origin: org.jruby/jruby-core
public RubyNil(Ruby runtime) {
super(runtime, runtime.getNilClass(), false);
flags |= NIL_F | FALSE_F | FROZEN_F;
if (RubyInstanceConfig.CONSISTENT_HASHING_ENABLED) {
// default to a fixed value
this.hashCode = 34;
} else {
// save the object id based hash code;
this.hashCode = System.identityHashCode(this);
}
constant = OptoFactory.newConstantWrapper(IRubyObject.class, this);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/** nil_type
*
*/
@JRubyMethod(name = "type", compat = CompatVersion.RUBY1_8)
public static RubyClass type(IRubyObject recv) {
return recv.getRuntime().getNilClass();
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/** nil_type
*
*/
@JRubyMethod(name = "type", compat = CompatVersion.RUBY1_8)
public static RubyClass type(IRubyObject recv) {
return recv.getRuntime().getNilClass();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static RubyClass createPointerClass(Ruby runtime, RubyModule module) {
RubyClass pointerClass = module.defineClassUnder("Pointer",
module.getClass(AbstractMemory.ABSTRACT_MEMORY_RUBY_CLASS),
RubyInstanceConfig.REIFY_RUBY_CLASSES ? new ReifyingAllocator(Pointer.class) : PointerAllocator.INSTANCE);
pointerClass.defineAnnotatedMethods(Pointer.class);
pointerClass.defineAnnotatedConstants(Pointer.class);
pointerClass.setReifiedClass(Pointer.class);
pointerClass.kindOf = new RubyModule.KindOf() {
@Override
public boolean isKindOf(IRubyObject obj, RubyModule type) {
return obj instanceof Pointer && super.isKindOf(obj, type);
}
};
module.defineClassUnder("NullPointerError", runtime.getRuntimeError(),
runtime.getRuntimeError().getAllocator());
// Add Pointer::NULL as a constant
Pointer nullPointer = new Pointer(runtime, pointerClass, new NullMemoryIO(runtime));
pointerClass.setConstant("NULL", nullPointer);
runtime.getNilClass().addMethod("to_ptr", new NilToPointerMethod(runtime.getNilClass(), nullPointer));
return pointerClass;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static RubyClass createPointerClass(Ruby runtime, RubyModule module) {
RubyClass pointerClass = module.defineClassUnder("Pointer",
module.getClass(AbstractMemory.ABSTRACT_MEMORY_RUBY_CLASS),
RubyInstanceConfig.REIFY_RUBY_CLASSES ? new ReifyingAllocator(Pointer.class) : PointerAllocator.INSTANCE);
pointerClass.defineAnnotatedMethods(Pointer.class);
pointerClass.defineAnnotatedConstants(Pointer.class);
pointerClass.setReifiedClass(Pointer.class);
pointerClass.kindOf = new RubyModule.KindOf() {
@Override
public boolean isKindOf(IRubyObject obj, RubyModule type) {
return obj instanceof Pointer && super.isKindOf(obj, type);
}
};
module.defineClassUnder("NullPointerError", runtime.getRuntimeError(),
runtime.getRuntimeError().getAllocator());
// Add Pointer::NULL as a constant
Pointer nullPointer = new Pointer(runtime, pointerClass, new NullMemoryIO(runtime));
pointerClass.setConstant("NULL", nullPointer);
runtime.getNilClass().addMethod("to_ptr", new NilToPointerMethod(runtime.getNilClass(), nullPointer));
return pointerClass;
}
代码示例来源:origin: org.jruby/jruby-complete
public static RubyClass createPointerClass(Ruby runtime, RubyModule module) {
RubyClass pointerClass = module.defineClassUnder("Pointer",
module.getClass(AbstractMemory.ABSTRACT_MEMORY_RUBY_CLASS),
Options.REIFY_FFI.load() ? new ReifyingAllocator(Pointer.class) : PointerAllocator.INSTANCE);
pointerClass.defineAnnotatedMethods(Pointer.class);
pointerClass.defineAnnotatedConstants(Pointer.class);
pointerClass.setReifiedClass(Pointer.class);
pointerClass.kindOf = new RubyModule.KindOf() {
@Override
public boolean isKindOf(IRubyObject obj, RubyModule type) {
return obj instanceof Pointer && super.isKindOf(obj, type);
}
};
module.defineClassUnder("NullPointerError", runtime.getRuntimeError(),
runtime.getRuntimeError().getAllocator());
// Add Pointer::NULL as a constant
Pointer nullPointer = new Pointer(runtime, pointerClass, new NullMemoryIO(runtime));
pointerClass.setConstant("NULL", nullPointer);
runtime.getNilClass().addMethod("to_ptr", new NilToPointerMethod(runtime.getNilClass(), nullPointer, "to_ptr"));
return pointerClass;
}
代码示例来源:origin: org.jruby/jruby-core
public static RubyClass createPointerClass(Ruby runtime, RubyModule module) {
RubyClass pointerClass = module.defineClassUnder("Pointer",
module.getClass(AbstractMemory.ABSTRACT_MEMORY_RUBY_CLASS),
Options.REIFY_FFI.load() ? new ReifyingAllocator(Pointer.class) : PointerAllocator.INSTANCE);
pointerClass.defineAnnotatedMethods(Pointer.class);
pointerClass.defineAnnotatedConstants(Pointer.class);
pointerClass.setReifiedClass(Pointer.class);
pointerClass.kindOf = new RubyModule.KindOf() {
@Override
public boolean isKindOf(IRubyObject obj, RubyModule type) {
return obj instanceof Pointer && super.isKindOf(obj, type);
}
};
module.defineClassUnder("NullPointerError", runtime.getRuntimeError(),
runtime.getRuntimeError().getAllocator());
// Add Pointer::NULL as a constant
Pointer nullPointer = new Pointer(runtime, pointerClass, new NullMemoryIO(runtime));
pointerClass.setConstant("NULL", nullPointer);
runtime.getNilClass().addMethod("to_ptr", new NilToPointerMethod(runtime.getNilClass(), nullPointer, "to_ptr"));
return pointerClass;
}
内容来源于网络,如有侵权,请联系作者删除!