org.jruby.RubyModule.getBaseName()方法的使用及代码示例

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

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

RubyModule.getBaseName介绍

[英]Get the base name of this class, or null if it is an anonymous class.
[中]获取该类的基名称,如果是匿名类,则为null。

代码示例

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

static void log(RubyModule implementationClass, String file, int line, String name, String message, String... reason) {
    boolean isBlock = implementationClass == null;
    String className = isBlock ? "<block>" : implementationClass.getBaseName();
    if (className == null) className = "<anon class>";

    StringBuilder builder = new StringBuilder(32);
    builder.append(message).append(": ").append(className)
        .append(' ').append(name == null ? "" : name)
        .append(" at ").append(file).append(':').append(line);

    if (reason.length > 0) {
      builder.append(" because of: \"");
      for (String aReason : reason) builder.append(aReason);
      builder.append('"');
    }

    LOG.info(builder.toString());
  }
}

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

static void log(RubyModule implementationClass, String file, int line, String name, String message, String... reason) {
    boolean isBlock = implementationClass == null;
    String className = isBlock ? "<block>" : implementationClass.getBaseName();
    if (className == null) className = "<anon class>";

    StringBuilder builder = new StringBuilder(32);
    builder.append(message).append(": ").append(className)
        .append(' ').append(name == null ? "" : name)
        .append(" at ").append(file).append(':').append(line);

    if (reason.length > 0) {
      builder.append(" because of: \"");
      for (String aReason : reason) builder.append(aReason);
      builder.append('"');
    }

    LOG.info(builder.toString());
  }
}

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

static void log(DefaultMethod method, String name, String message, String... reason) {
  String className = method.getImplementationClass().getBaseName();
  
  if (className == null) className = "<anon class>";
  StringBuilder builder = new StringBuilder(message + ":" + className + "." + name + " at " + method.getPosition());
  
  if (reason.length > 0) {
    builder.append(" because of: \"");
    for (int i = 0; i < reason.length; i++) {
      builder.append(reason[i]);
    }
    builder.append('"');
  }
  
  LOG.info(builder.toString());
}

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

static void log(DefaultMethod method, String name, String message, String... reason) {
  String className = method.getImplementationClass().getBaseName();
  
  if (className == null) className = "<anon class>";
  StringBuilder builder = new StringBuilder(message + ":" + className + "." + name + " at " + method.getPosition());
  
  if (reason.length > 0) {
    builder.append(" because of: \"");
    for (int i = 0; i < reason.length; i++) {
      builder.append(reason[i]);
    }
    builder.append('"');
  }
  
  LOG.info(builder.toString());
}

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

private void setParentForModule(final String name, final IRubyObject value) {
  // if adding a module under a constant name, set that module's basename to the constant name
  if ( value instanceof RubyModule ) {
    RubyModule module = (RubyModule) value;
    if (module != this && module.getBaseName() == null) {
      module.setBaseName(name);
      module.setParent(this);
    }
    module.calculateName();
  }
}

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

private void setParentForModule(final String name, final IRubyObject value) {
  // if adding a module under a constant name, set that module's basename to the constant name
  if ( value instanceof RubyModule ) {
    RubyModule module = (RubyModule) value;
    if (module != this && module.getBaseName() == null) {
      module.setBaseName(name);
      module.setParent(this);
    }
    module.calculateName();
  }
}

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

public RubyString rubyBaseName() {
  String baseName = getBaseName();
  return baseName == null ? null : (RubyString) getRuntime().newSymbol(baseName).to_s();
}

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

public RubyString rubyBaseName() {
  String baseName = getBaseName();
  return baseName == null ? null : (RubyString) getRuntime().newSymbol(baseName).to_s();
}

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

@JRubyMethod(name = "name")
public IRubyObject name() {
  Ruby runtime = getRuntime();
  if (getBaseName() == null) {
    return RubyString.newEmptyString(runtime);
  } else {
    return runtime.newString(getName());
  }
}

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

@JRubyMethod(name = "name")
public IRubyObject name() {
  Ruby runtime = getRuntime();
  if (getBaseName() == null) {
    return RubyString.newEmptyString(runtime);
  } else {
    return runtime.newString(getName());
  }
}

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

@JRubyMethod(name = "name", compat = RUBY1_9)
public IRubyObject name19() {
  Ruby runtime = getRuntime();
  if (getBaseName() == null) {
    return runtime.getNil();
  } else {
    return runtime.newString(getName());
  }
}

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

@JRubyMethod(name = "name", compat = RUBY1_9)
public IRubyObject name19() {
  Ruby runtime = getRuntime();
  if (getBaseName() == null) {
    return runtime.getNil();
  } else {
    return runtime.newString(getName());
  }
}

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

@JRubyMethod(name = "name")
public IRubyObject name19() {
  return getBaseName() == null ? getRuntime().getNil() : rubyName().strDup(getRuntime());
}

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

@JRubyMethod(name = "name")
public IRubyObject name19() {
  return getBaseName() == null ? getRuntime().getNil() : rubyName().strDup(getRuntime());
}

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

private void checkAndRaiseIfFrozen() throws RaiseException {
  if ( isFrozen() ) {
    if (this instanceof RubyClass) {
      if (getBaseName() == null) { // anonymous
        // MRI 2.2.2 does get ugly ... as it skips this logic :
        // RuntimeError: can't modify frozen #<Class:#<Class:0x0000000095a920>>
        throw getRuntime().newFrozenError(getName());
      }
      throw getRuntime().newFrozenError("#<Class:" + getName() + '>');
    }
    throw getRuntime().newFrozenError("Module");
  }
}

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

private RubyString calculateRubyName() {
  boolean cache = true;
  if (getBaseName() == null) return calculateAnonymousRubyName(); // no name...anonymous!

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

private void checkAndRaiseIfFrozen() throws RaiseException {
  if ( isFrozen() ) {
    if (this instanceof RubyClass) {
      if (getBaseName() == null) { // anonymous
        // MRI 2.2.2 does get ugly ... as it skips this logic :
        // RuntimeError: can't modify frozen #<Class:#<Class:0x0000000095a920>>
        throw getRuntime().newFrozenError(getName());
      }
      throw getRuntime().newFrozenError("#<Class:" + getName() + '>');
    }
    throw getRuntime().newFrozenError("Module");
  }
}

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

private RubyString calculateRubyName() {
  boolean cache = true;
  if (getBaseName() == null) return calculateAnonymousRubyName(); // no name...anonymous!

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

String name = type.getBaseName();
if (name == null) {
  if (type.isSingleton()) {

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

String baseName = getBaseName();
char refChar = '#';
String simpleName = getSimpleName();

相关文章

微信公众号

最新文章

更多

RubyModule类方法