org.jruby.RubyClass.smartLoadNewUser()方法的使用及代码示例

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

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

RubyClass.smartLoadNewUser介绍

[英]Load marshaled data into a blank target object using marshal_load, being "smart" and caching the mechanism for invoking marshal_load. If the class implements a custom respond_to?, cache nothing and go slow path invocation of respond_to? and marshal_load every time. Raise error if respond_to? :marshal_load returns true and no :marshal_load is defined. If the class implements marshal_load, cache and use that. Otherwise, error, since marshal_load is not present.
[中]使用marshal_Load将封送的数据加载到一个空白的目标对象中,这是“智能”的,并缓存调用marshal_Load的机制。如果类实现了一个自定义的respond_to?,不缓存任何内容,并缓慢调用respond_to?每一次都是马绍尔。如果响应?\u,则引发错误:marshal_load返回true,no:定义了marshal_load。如果类实现了marshal_load,则缓存并使用它。否则会出现错误,因为封送加载不存在。

代码示例

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

private IRubyObject userNewUnmarshal() throws IOException {
  String className = unmarshalObject(false).asJavaString();
  RubyClass classInstance = findClass(className);
  IRubyObject result = classInstance.allocate();
  registerLinkTarget(result);
  IRubyObject marshaled = unmarshalObject();
  return classInstance.smartLoadNewUser(result, marshaled);
}

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

private IRubyObject userNewUnmarshal() throws IOException {
  String className = unmarshalObject(false).asJavaString();
  RubyClass classInstance = findClass(className);
  IRubyObject result = classInstance.allocate();
  registerLinkTarget(result);
  IRubyObject marshaled = unmarshalObject();
  return classInstance.smartLoadNewUser(result, marshaled);
}

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

private IRubyObject userNewUnmarshal() throws IOException {
  String className = unmarshalObject(false).asJavaString();
  RubyClass classInstance = findClass(className);
  IRubyObject result = classInstance.allocate();
  registerLinkTarget(result);
  IRubyObject marshaled = unmarshalObject();
  return classInstance.smartLoadNewUser(result, marshaled);
}

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

private IRubyObject userNewUnmarshal() throws IOException {
  String className = unmarshalObject(false).asJavaString();
  RubyClass classInstance = findClass(className);
  IRubyObject result = classInstance.allocate();
  registerLinkTarget(result);
  IRubyObject marshaled = unmarshalObject();
  return classInstance.smartLoadNewUser(result, marshaled);
}

相关文章

微信公众号

最新文章

更多

RubyClass类方法