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

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

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

RubyClass.getClass介绍

暂无

代码示例

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

/**
 * Retrieve the class with the given name from the Object namespace.
 *
 * @param name The name of the class
 * @return The class
 */
public RubyClass getClass(String name) {
  return objectClass.getClass(name);
}

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

/**
 * Retrieve the class with the given name from the Object namespace.
 *
 * @param name The name of the class
 * @return The class
 */
public RubyClass getClass(String name) {
  return objectClass.getClass(name);
}

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

/**
 * Initializes a new <tt>Type.Array</tt> instance.
 */
public Array(Ruby runtime, Type componentType, int length) {
  this(runtime, getTypeClass(runtime).getClass("Array"), componentType, length);
}

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

/**
 * Initializes a new <tt>Type.Array</tt> instance.
 */
public Array(Ruby runtime, Type componentType, int length) {
  this(runtime, getTypeClass(runtime).getClass("Array"), componentType, length);
}

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

/**
 * Initializes a new <tt>Type.Array</tt> instance.
 */
public Array(Ruby runtime, Type componentType, int length) {
  this(runtime, getTypeClass(runtime).getClass("Array"), componentType, length);
}

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

@Deprecated
public RaiseException newInvalidEncoding(String message) {
  return newRaiseException(getClass("Iconv").getClass("InvalidEncoding"), message);
}

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

StructByValue(Ruby runtime, RubyClass structClass, StructLayout structLayout) {
  super(runtime, runtime.getModule("FFI").getClass("Type").getClass("Struct"),
      NativeType.STRUCT, structLayout.size, structLayout.alignment);
  this.structClass = structClass;
  this.structLayout = structLayout;
}

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

public Symbol(Ruby runtime, DynamicLibrary library, String name, MemoryIO io) {
  super(runtime, runtime.getModule("FFI").getClass("DynamicLibrary").getClass("Symbol"),
      io, Long.MAX_VALUE);
  this.library = library;
  this.name = name;
}

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

public Symbol(Ruby runtime, DynamicLibrary library, String name, MemoryIO io) {
  super(runtime, runtime.getModule("FFI").getClass("DynamicLibrary").getClass("Symbol"),
      io, Long.MAX_VALUE);
  this.library = library;
  this.name = name;
}

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

@Override
  @JRubyMethod(name="initialize", visibility = PRIVATE, required = 3, optional = 1)
  public final IRubyObject initialize(ThreadContext context, IRubyObject[] args) {
    
    IRubyObject type = args[2];
    if (!(type instanceof CallbackInfo)) {
      throw context.runtime.newTypeError(type, context.runtime.getModule("FFI").getClass("Type").getClass("Function"));
    }
    init(args, FunctionFieldIO.INSTANCE);
    return this;
  }
}

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

private static Mutex getMutexForThreadExclusive(ThreadContext context, RubyClass recv) {
  Mutex mutex = (Mutex) recv.getConstantNoConstMissing(MUTEX_FOR_THREAD_EXCLUSIVE, false, false);
  if (mutex != null) return mutex;
  synchronized (recv) {
    mutex = (Mutex) recv.getConstantNoConstMissing(MUTEX_FOR_THREAD_EXCLUSIVE, false, false);
    if (mutex == null) {
      mutex = Mutex.newInstance(context, context.runtime.getThread().getClass("Mutex"), NULL_ARRAY, Block.NULL_BLOCK);
      recv.setConstant(MUTEX_FOR_THREAD_EXCLUSIVE, mutex, true);
    }
    return mutex;
  }
}

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

@Override
  @JRubyMethod(name="initialize", visibility = PRIVATE, required = 3, optional = 1)
  public final IRubyObject initialize(ThreadContext context, IRubyObject[] args) {
    
    IRubyObject type = args[2];
    if (!(type instanceof CallbackInfo)) {
      throw context.runtime.newTypeError(type, context.runtime.getModule("FFI").getClass("Type").getClass("Function"));
    }
    init(args, FunctionFieldIO.INSTANCE);
    return this;
  }
}

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

@Override
  @JRubyMethod(name="initialize", visibility = PRIVATE, required = 3, optional = 1)
  public final IRubyObject initialize(ThreadContext context, IRubyObject[] args) {
    IRubyObject type = args[2];
    if (!(type instanceof Type.Array)) {
      throw context.runtime.newTypeError(type,
          context.runtime.getModule("FFI").getClass("Type").getClass("Array"));
    }
    init(args, new ArrayFieldIO((Type.Array) type));
    return this;
  }
}

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

@Override
  @JRubyMethod(name="initialize", visibility = PRIVATE, required = 3, optional = 1)
  public final IRubyObject initialize(ThreadContext context, IRubyObject[] args) {
    IRubyObject type = args[2];
    if (!(type instanceof Type.Array)) {
      throw context.runtime.newTypeError(type,
          context.runtime.getModule("FFI").getClass("Type").getClass("Array"));
    }
    init(args, new ArrayFieldIO((Type.Array) type));
    return this;
  }
}

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

static RaiseException newGzipFileError(Ruby runtime, String klass, String message) {
  RubyClass errorClass = runtime.getModule("Zlib").getClass("GzipFile").getClass(klass);
  RubyException excn = RubyException.newException(runtime, errorClass, message);
  // TODO: not yet supported. rewrite GzipReader/Writer with Inflate/Deflate?
  excn.setInstanceVariable("@input", runtime.getNil());
  return excn.toThrowable();
}

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

@Override
  @JRubyMethod(name="initialize", visibility = PRIVATE, required = 3, optional = 1)
  public IRubyObject initialize(ThreadContext context, IRubyObject[] args) {
    IRubyObject type = args[2];
    if (!(type instanceof StructByValue)) {
      throw context.runtime.newTypeError(type,
          context.runtime.getModule("FFI").getClass("Type").getClass("Struct"));
    }
    init(args, new InnerStructFieldIO((StructByValue) type));
    return this;
  }
}

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

private RaiseException newRefError(String message) {
    Ruby runtime = getRuntime();
    ThreadContext context = runtime.getCurrentContext();
    RubyException exception =
        (RubyException)runtime.getClass("WeakRef").getClass("RefError").newInstance(context,
        new IRubyObject[] {runtime.newString(message)}, Block.NULL_BLOCK);
    
    RaiseException re = new RaiseException(exception);
    return re;
  }
}

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

@JRubyMethod(name = "unscan")
public IRubyObject unscan() {
  check();
  Ruby runtime = getRuntime();
  if (!isMatched()) {
    RubyClass errorClass = runtime.getClass("StringScanner").getClass("Error");
    throw RaiseException.from(runtime, errorClass, "unscan failed: previous match had failed");
  }
  pos = lastPos;
  clearMatched();
  return this;
}

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

@JRubyMethod(name = "unscan")
public IRubyObject unscan() {
  check();
  Ruby runtime = getRuntime();
  if (!isMatched()) {
    RubyClass errorClass = runtime.getClass("StringScanner").getClass("Error");
    throw RaiseException.from(runtime, errorClass, "unscan failed: previous match had failed");
  }
  pos = lastPos;
  clearMatched();
  return this;
}

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

static RaiseException newGzipFileError(Ruby runtime, String klass, String message) {
  RubyClass errorClass = runtime.getModule("Zlib").getClass("GzipFile").getClass(klass);
  RubyException excn = RubyException.newException(runtime, errorClass, message);
  if (runtime.is1_9()) {
    // TODO: not yet supported. rewrite GzipReader/Writer with Inflate/Deflate?
    excn.setInstanceVariable("@input", runtime.getNil());
  }
  return new RaiseException(excn, true);
}

相关文章

微信公众号

最新文章

更多

RubyClass类方法