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

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

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

Ruby.getStructClass介绍

暂无

代码示例

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

throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());
  throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());

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

throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());
  throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());

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

private static IRubyObject getInternalVariable(RubyClass type, String internedName) {
  RubyClass structClass = type.getRuntime().getStructClass();
  IRubyObject variable;
  while (type != null && type != structClass) {
    if ((variable = (IRubyObject)type.getInternalVariable(internedName)) != null) {
      return variable;
    }
    type = type.getSuperClass();
  }
  return type.getRuntime().getNil();
}

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

private static IRubyObject getInternalVariable(RubyClass type, String internedName) {
  RubyClass structClass = type.getRuntime().getStructClass();
  IRubyObject variable;
  while (type != null && type != structClass) {
    if ((variable = (IRubyObject)type.getInternalVariable(internedName)) != null) {
      return variable;
    }
    type = type.getSuperClass();
  }
  return type.getRuntime().getNil();
}

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

private static IRubyObject getInternalVariable(RubyClass type, String internedName) {
  RubyClass structClass = type.getRuntime().getStructClass();
  IRubyObject variable;
  while (type != null && type != structClass) {
    if ((variable = (IRubyObject)type.getInternalVariable(internedName)) != null) {
      return variable;
    }
    type = type.getSuperClass();
  }
  return type.getRuntime().getNil();
}

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

private static IRubyObject getInternalVariable(RubyClass type, String internedName) {
  RubyClass structClass = type.getRuntime().getStructClass();
  IRubyObject variable;
  while (type != null && type != structClass) {
    if ((variable = (IRubyObject)type.getInternalVariable(internedName)) != null) {
      return variable;
    }
    type = type.getSuperClass();
  }
  return type.getRuntime().getNil();
}

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

throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());
  throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());
  throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());

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

throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());
  throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());
  throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());

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

public static RubyStruct unmarshalFrom(UnmarshalStream input) throws java.io.IOException {
  final Ruby runtime = input.getRuntime();
  RubySymbol className = (RubySymbol) input.unmarshalObject(false);
  RubyClass rbClass = pathToClass(runtime, className.asJavaString());
  if (rbClass == null) {
    throw runtime.newNameError(UNINITIALIZED_CONSTANT, runtime.getStructClass(), className);
  }
  final RubyArray member = __member__(rbClass);
  final int len = input.unmarshalInt();
  // FIXME: This could all be more efficient, but it's how struct works
  final RubyStruct result;
  // 1.9 does not appear to call initialize (JRUBY-5875)
  result = new RubyStruct(runtime, rbClass);
  input.registerLinkTarget(result);
  for (int i = 0; i < len; i++) {
    IRubyObject slot = input.unmarshalObject(false);
    final IRubyObject elem = member.eltInternal(i); // RubySymbol
    if ( ! elem.toString().equals( slot.toString() ) ) {
      throw runtime.newTypeError("struct " + rbClass.getName() + " not compatible (:" + slot + " for :" + elem + ")");
    }
    result.aset(i, input.unmarshalObject());
  }
  return result;
}

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

public static RubyStruct unmarshalFrom(UnmarshalStream input) throws java.io.IOException {
  final Ruby runtime = input.getRuntime();
  RubySymbol className = (RubySymbol) input.unmarshalObject(false);
  RubyClass rbClass = pathToClass(runtime, className.asJavaString());
  if (rbClass == null) {
    throw runtime.newNameError(UNINITIALIZED_CONSTANT, runtime.getStructClass(), className);
  }
  final RubyArray member = __member__(rbClass);
  final int len = input.unmarshalInt();
  // FIXME: This could all be more efficient, but it's how struct works
  final RubyStruct result;
  // 1.9 does not appear to call initialize (JRUBY-5875)
  result = new RubyStruct(runtime, rbClass);
  input.registerLinkTarget(result);
  for (int i = 0; i < len; i++) {
    IRubyObject slot = input.unmarshalObject(false);
    final IRubyObject elem = member.eltInternal(i); // RubySymbol
    if ( ! elem.toString().equals( slot.toString() ) ) {
      throw runtime.newTypeError("struct " + rbClass.getName() + " not compatible (:" + slot + " for :" + elem + ")");
    }
    result.aset(i, input.unmarshalObject());
  }
  return result;
}

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

private static void defineGroupStruct(Ruby runtime) {
  IRubyObject[] args = new IRubyObject[] {
      runtime.newString("Group"),
      runtime.newSymbol("name"),
      runtime.newSymbol("passwd"),
      runtime.newSymbol("gid"),
      runtime.newSymbol("mem")
  };
  
  runtime.setGroupStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK));
  runtime.getEtc().defineConstant("Group", runtime.getGroupStruct());
}

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

private static void defineGroupStruct(Ruby runtime) {
  IRubyObject[] args = new IRubyObject[] {
      runtime.newString("Group"),
      runtime.newSymbol("name"),
      runtime.newSymbol("passwd"),
      runtime.newSymbol("gid"),
      runtime.newSymbol("mem")
  };
  
  runtime.setGroupStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK));
  runtime.getEtc().defineConstant("Group", runtime.getGroupStruct());
}

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

private static void defineGroupStruct(Ruby runtime) {
  IRubyObject[] args = new IRubyObject[] {
      runtime.newString("Group"),
      runtime.newSymbol("name"),
      runtime.newSymbol("passwd"),
      runtime.newSymbol("gid"),
      runtime.newSymbol("mem")
  };
  
  runtime.setGroupStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK));
  if (runtime.is1_9()) {
    runtime.getEtc().defineConstant("Group", runtime.getGroupStruct());
  }
}

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

private static void defineGroupStruct(Ruby runtime) {
  IRubyObject[] args = new IRubyObject[] {
      runtime.newString("Group"),
      runtime.newSymbol("name"),
      runtime.newSymbol("passwd"),
      runtime.newSymbol("gid"),
      runtime.newSymbol("mem")
  };
  
  runtime.setGroupStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK));
  if (runtime.is1_9()) {
    runtime.getEtc().defineConstant("Group", runtime.getGroupStruct());
  }
}

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

private static void definePasswdStruct(Ruby runtime) {
  IRubyObject[] args = new IRubyObject[] {
      runtime.newString("Passwd"),
      runtime.newSymbol("name"),
      runtime.newSymbol("passwd"),
      runtime.newSymbol("uid"),
      runtime.newSymbol("gid"),
      runtime.newSymbol("gecos"),
      runtime.newSymbol("dir"),
      runtime.newSymbol("shell"),
      runtime.newSymbol("change"),
      runtime.newSymbol("uclass"),
      runtime.newSymbol("expire")
  };
  
  runtime.setPasswdStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK));
  if (runtime.is1_9()) {
    runtime.getEtc().defineConstant("Passwd", runtime.getPasswdStruct());
  }
}

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

private static void definePasswdStruct(Ruby runtime) {
  IRubyObject[] args = new IRubyObject[] {
      runtime.newString("Passwd"),
      runtime.newSymbol("name"),
      runtime.newSymbol("passwd"),
      runtime.newSymbol("uid"),
      runtime.newSymbol("gid"),
      runtime.newSymbol("gecos"),
      runtime.newSymbol("dir"),
      runtime.newSymbol("shell"),
      runtime.newSymbol("change"),
      runtime.newSymbol("uclass"),
      runtime.newSymbol("expire")
  };
  
  runtime.setPasswdStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK));
  if (runtime.is1_9()) {
    runtime.getEtc().defineConstant("Passwd", runtime.getPasswdStruct());
  }
}

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

private static void definePasswdStruct(Ruby runtime) {
  IRubyObject[] args = new IRubyObject[] {
      runtime.newString("Passwd"),
      runtime.newSymbol("name"),
      runtime.newSymbol("passwd"),
      runtime.newSymbol("uid"),
      runtime.newSymbol("gid"),
      runtime.newSymbol("gecos"),
      runtime.newSymbol("dir"),
      runtime.newSymbol("shell"),
      runtime.newSymbol("change"),
      runtime.newSymbol("uclass"),
      runtime.newSymbol("expire")
  };
  
  runtime.setPasswdStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK));
  runtime.getEtc().defineConstant("Passwd", runtime.getPasswdStruct());
}

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

private static void definePasswdStruct(Ruby runtime) {
  IRubyObject[] args = new IRubyObject[] {
      runtime.newString("Passwd"),
      runtime.newSymbol("name"),
      runtime.newSymbol("passwd"),
      runtime.newSymbol("uid"),
      runtime.newSymbol("gid"),
      runtime.newSymbol("gecos"),
      runtime.newSymbol("dir"),
      runtime.newSymbol("shell"),
      runtime.newSymbol("change"),
      runtime.newSymbol("uclass"),
      runtime.newSymbol("expire")
  };
  
  runtime.setPasswdStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK));
  runtime.getEtc().defineConstant("Passwd", runtime.getPasswdStruct());
}

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

runtime.getStructClass(),
new IRubyObject[]{
    runtime.newString("Tms"),

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

runtime.getStructClass(),
new IRubyObject[]{
    runtime.newString("Tms"),

相关文章

Ruby类方法