本文整理了Java中org.jruby.RubyClass.smartDump
方法的一些代码示例,展示了RubyClass.smartDump
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyClass.smartDump
方法的具体详情如下:
包路径:org.jruby.RubyClass
类名称:RubyClass
方法名:smartDump
[英]Marshal the given object to the marshaling stream, being "smart" and caching how to do that marshaling. If the class defines a custom "respond_to?" method, then the behavior of dumping could vary without our class structure knowing it. As a result, we do only the slow-path classic behavior. If the class defines a real "marshal_dump" method, we cache and use that. If the class defines a real "_dump" method, we cache and use that. If the class neither defines none of the above methods, we use a fast path directly to the default dumping logic.
[中]将给定对象封送到封送处理流,做到“智能”并缓存如何进行封送处理。如果类定义了一个自定义的“respond_to?”方法,则在我们的类结构不知道的情况下,转储行为可能会发生变化。因此,我们只做慢路径的经典行为。如果该类定义了一个真正的“marshal_dump”方法,我们将缓存并使用它。如果类定义了一个真正的“_dump”方法,我们将缓存并使用它。如果该类既不定义上述任何一种方法,我们将使用一条直接指向默认转储逻辑的快速路径。
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private void writeAndRegister(IRubyObject value) throws IOException {
if (cache.isRegistered(value)) {
cache.writeLink(this, value);
} else {
value.getMetaClass().smartDump(this, value);
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private void writeAndRegister(IRubyObject value) throws IOException {
if (cache.isRegistered(value)) {
cache.writeLink(this, value);
} else {
value.getMetaClass().smartDump(this, value);
}
}
代码示例来源:origin: org.jruby/jruby-complete
private void writeAndRegister(IRubyObject value) throws IOException {
ByteList sym;
if (value instanceof RubySymbol && cache.isSymbolRegistered(sym = ((RubySymbol) value).getBytes())) {
cache.writeSymbolLink(this, sym);
} else if (!(value instanceof RubySymbol) && cache.isRegistered(value)) {
cache.writeLink(this, value);
} else {
value.getMetaClass().smartDump(this, value);
}
}
代码示例来源:origin: org.jruby/jruby-core
private void writeAndRegister(IRubyObject value) throws IOException {
ByteList sym;
if (value instanceof RubySymbol && cache.isSymbolRegistered(sym = ((RubySymbol) value).getBytes())) {
cache.writeSymbolLink(this, sym);
} else if (!(value instanceof RubySymbol) && cache.isRegistered(value)) {
cache.writeLink(this, value);
} else {
value.getMetaClass().smartDump(this, value);
}
}
内容来源于网络,如有侵权,请联系作者删除!