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

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

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

Ruby.getClassClass介绍

暂无

代码示例

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

/** used by CLASS_ALLOCATOR (any Class' class will be a Class!)
 *  also used to bootstrap Object class
 */
protected RubyClass(Ruby runtime) {
  super(runtime, runtime.getClassClass());
  this.runtime = runtime;
  this.realClass = this;
  this.variableTableManager = new VariableTableManager(this);
  index = ClassIndex.CLASS;
}

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

/** used by CLASS_ALLOCATOR (any Class' class will be a Class!)
 *  also used to bootstrap Object class
 */
protected RubyClass(Ruby runtime) {
  super(runtime, runtime.getClassClass());
  this.runtime = runtime;
  this.realClass = this;
  this.variableTableManager = new VariableTableManager(this);
  index = ClassIndex.CLASS;
}

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

/** used by CLASS_ALLOCATOR (any Class' class will be a Class!)
 *  also used to bootstrap Object class
 */
protected RubyClass(Ruby runtime) {
  super(runtime, runtime.getClassClass());
  this.runtime = runtime;
  this.realClass = this;
  this.variableTableManager = new VariableTableManager(this);
  setClassIndex(ClassIndex.CLASS);
}

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

/** used by CLASS_ALLOCATOR (any Class' class will be a Class!)
 *  also used to bootstrap Object class
 */
protected RubyClass(Ruby runtime) {
  super(runtime, runtime.getClassClass());
  this.runtime = runtime;
  this.realClass = this;
  this.variableTableManager = new VariableTableManager(this);
  setClassIndex(ClassIndex.CLASS);
}

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

@JRubyMethod(visibility = PRIVATE)
public static IRubyObject build_exception(ThreadContext context, IRubyObject self, IRubyObject klass, IRubyObject message) {
  if (klass instanceof RubyClass) {
    IRubyObject exception = ((RubyClass)klass).allocate();
    ((RubyException)exception).message = message;
    return exception;
  } else {
    throw context.runtime.newTypeError(klass, context.runtime.getClassClass());
  }
}

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

@JRubyMethod
  public static IRubyObject inherited(ThreadContext context, IRubyObject self, IRubyObject subclass) {
    if ( ! ( subclass instanceof RubyClass ) ) {
      throw context.runtime.newTypeError(subclass, context.runtime.getClassClass());
    }
    JavaInterfaceTemplate.addRealImplClassNew((RubyClass) subclass);
    return context.nil;
  }
};

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

@JRubyMethod
  public static IRubyObject inherited(ThreadContext context, IRubyObject self, IRubyObject subclass) {
    if ( ! ( subclass instanceof RubyClass ) ) {
      throw context.runtime.newTypeError(subclass, context.runtime.getClassClass());
    }
    JavaInterfaceTemplate.addRealImplClassNew((RubyClass) subclass);
    return context.nil;
  }
};

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

/**
 * Construct a new class with the given name scoped under Object (global)
 * and with Object as its immediate superclass.
 * Corresponds to rb_class_new in MRI.
 */
public static RubyClass newClass(Ruby runtime, RubyClass superClass) {
  if (superClass == runtime.getClassClass()) throw runtime.newTypeError("can't make subclass of Class");
  if (superClass.isSingleton()) throw runtime.newTypeError("can't make subclass of virtual class");
  return new RubyClass(runtime, superClass);
}

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

@JRubyMethod(meta = true)
public static RubyObject get_with_class(final IRubyObject self, IRubyObject obj) {
  final Ruby runtime = self.getRuntime();
  if (!(obj instanceof RubyClass)) {
    throw runtime.newTypeError(obj, runtime.getClassClass());
  }
  return getProxyClass(runtime, (RubyClass) obj);
}

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

/** 
 * A variation on newClass that allow passing in an array of supplementary
 * call sites to improve dynamic invocation.
 */
public static RubyClass newClass(Ruby runtime, RubyClass superClass, CallSite[] extraCallSites) {
  if (superClass == runtime.getClassClass()) throw runtime.newTypeError("can't make subclass of Class");
  if (superClass.isSingleton()) throw runtime.newTypeError("can't make subclass of virtual class");
  return new RubyClass(runtime, superClass, extraCallSites);        
}

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

/**
 * A variation on newClass that allow passing in an array of supplementary
 * call sites to improve dynamic invocation.
 */
public static RubyClass newClass(Ruby runtime, RubyClass superClass, CallSite[] extraCallSites) {
  if (superClass == runtime.getClassClass()) throw runtime.newTypeError("can't make subclass of Class");
  if (superClass.isSingleton()) throw runtime.newTypeError("can't make subclass of virtual class");
  return new RubyClass(runtime, superClass, extraCallSites);
}

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

@JRubyMethod(meta = true)
public static RubyObject get_with_class(final IRubyObject self, IRubyObject obj) {
  final Ruby runtime = self.getRuntime();
  if (!(obj instanceof RubyClass)) {
    throw runtime.newTypeError(obj, runtime.getClassClass());
  }
  return getProxyClass(runtime, (RubyClass) obj);
}

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

/**
 * A variation on newClass that allow passing in an array of supplementary
 * call sites to improve dynamic invocation.
 */
public static RubyClass newClass(Ruby runtime, RubyClass superClass, CallSite[] extraCallSites) {
  if (superClass == runtime.getClassClass()) throw runtime.newTypeError("can't make subclass of Class");
  if (superClass.isSingleton()) throw runtime.newTypeError("can't make subclass of virtual class");
  return new RubyClass(runtime, superClass, extraCallSites);
}

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

/** 
 * Construct a new class with the given name scoped under Object (global)
 * and with Object as its immediate superclass.
 * Corresponds to rb_class_new in MRI.
 */
public static RubyClass newClass(Ruby runtime, RubyClass superClass) {
  if (superClass == runtime.getClassClass()) throw runtime.newTypeError("can't make subclass of Class");
  if (superClass.isSingleton()) throw runtime.newTypeError("can't make subclass of virtual class");
  return new RubyClass(runtime, superClass);        
}

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

/**
 * Construct a new class with the given name scoped under Object (global)
 * and with Object as its immediate superclass.
 * Corresponds to rb_class_new in MRI.
 */
public static RubyClass newClass(Ruby runtime, RubyClass superClass) {
  if (superClass == runtime.getClassClass()) throw runtime.newTypeError("can't make subclass of Class");
  if (superClass.isSingleton()) throw runtime.newTypeError("can't make subclass of virtual class");
  return new RubyClass(runtime, superClass);
}

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

/** rb_mod_append_features
 *
 */
@JRubyMethod(name = "append_features", required = 1, visibility = PRIVATE)
public RubyModule append_features(IRubyObject module) {
  if (!(module instanceof RubyModule)) {
    // MRI error message says Class, even though Module is ok 
    throw getRuntime().newTypeError(module,getRuntime().getClassClass());
  }
  ((RubyModule) module).includeModule(this);
  return this;
}

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

private static IRubyObject invokeProxyClassInherited(final ThreadContext context,
  final IRubyObject clazz, final IRubyObject subclazz) {
  final JavaSupport javaSupport = context.runtime.getJavaSupport();
  RubyClass javaProxyClass = javaSupport.getJavaProxyClass().getMetaClass();
  Helpers.invokeAs(context, javaProxyClass, clazz, "inherited", subclazz, Block.NULL_BLOCK);
  if ( ! ( subclazz instanceof RubyClass ) ) {
    throw context.runtime.newTypeError(subclazz, context.runtime.getClassClass());
  }
  setupJavaSubclass(context, (RubyClass) subclazz);
  return context.nil;
}

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

@JRubyMethod
  public static IRubyObject inherited(IRubyObject recv, IRubyObject arg0) {
    if (!(arg0 instanceof RubyClass)) {
      throw recv.getRuntime().newTypeError(arg0, recv.getRuntime().getClassClass());
    }
    
    JavaInterfaceTemplate.addRealImplClassNew((RubyClass)arg0);
    return recv.getRuntime().getNil();
  }
};

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

private RubyClass getSuperSingletonMetaClass() {
  if (attached instanceof RubyClass) {
    RubyClass superClass = ((RubyClass) attached).getSuperClass();
    if (superClass != null) superClass = superClass.getRealClass();
    // #<Class:BasicObject>'s singleton class == Class.singleton_class
    if (superClass == null) return runtime.getClassClass().getSingletonClass();
    return superClass.getMetaClass().getSingletonClass();
  }
  return getSuperClass().getRealClass().getMetaClass(); // NOTE: is this correct?
}

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

private RubyClass getSuperSingletonMetaClass() {
  if (attached instanceof RubyClass) {
    RubyClass superClass = ((RubyClass) attached).getSuperClass();
    if (superClass != null) superClass = superClass.getRealClass();
    // #<Class:BasicObject>'s singleton class == Class.singleton_class
    if (superClass == null) return runtime.getClassClass().getSingletonClass();
    return superClass.getMetaClass().getSingletonClass();
  }
  return getSuperClass().getRealClass().getMetaClass(); // NOTE: is this correct?
}

相关文章

Ruby类方法