本文整理了Java中org.jruby.RubyModule.getName
方法的一些代码示例,展示了RubyModule.getName
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyModule.getName
方法的具体详情如下:
包路径:org.jruby.RubyModule
类名称:RubyModule
方法名:getName
[英]Generate a fully-qualified class name or a #-style name for anonymous and singleton classes. Ruby C equivalent = "classname"
[中]为匿名类和单例类生成完全限定的类名或#样式的名称。Ruby C equired=“classname”
代码示例来源:origin: org.jruby/jruby-core
@Override
public String getName() {
return origin.getName();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "inspect")
@Override
public IRubyObject inspect() {
RubyModule rubyClass = getMetaClass();
StringBuilder buffer = new StringBuilder("#<");
buffer.append(rubyClass.getName()).append(": ").append(success.inspect().toString());
buffer.append(", ").append(failed.inspect().toString()).append(">");
return getRuntime().newString(buffer.toString());
}
}
代码示例来源:origin: org.jruby/jruby-complete
protected void checkForCyclicPrepend(RubyModule m) throws RaiseException {
if (getNonIncludedClass() == m.getNonIncludedClass()) {
throw getRuntime().newArgumentError(getName() + " cyclic prepend detected " + m.getName());
}
}
代码示例来源:origin: org.jruby/jruby-core
protected void checkForCyclicPrepend(RubyModule m) throws RaiseException {
if (getNonIncludedClass() == m.getNonIncludedClass()) {
throw getRuntime().newArgumentError(getName() + " cyclic prepend detected " + m.getName());
}
}
代码示例来源:origin: org.jruby/jruby-core
public final void setConstantVisibility(Ruby runtime, String name, boolean hidden) {
ConstantEntry entry = getConstantMap().get(name);
if (entry == null) {
throw runtime.newNameError("constant " + getName() + "::" + name + " not defined", name);
}
storeConstant(name, entry.value, hidden);
}
代码示例来源:origin: org.jruby/jruby-complete
public final void setConstantVisibility(Ruby runtime, String name, boolean hidden) {
ConstantEntry entry = getConstantMap().get(name);
if (entry == null) {
throw runtime.newNameError("constant " + getName() + "::" + name + " not defined", name);
}
storeConstant(name, entry.value, hidden);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private void setConstantVisibility(ThreadContext context, String name, boolean hidden) {
ConstantEntry entry = getConstantMap().get(name);
if (entry == null) {
throw context.runtime.newNameError("constant " + getName() + "::" + name + " not defined", name);
}
getConstantMapForWrite().put(name, new ConstantEntry(entry.value, hidden));
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private void setConstantVisibility(ThreadContext context, String name, boolean hidden) {
ConstantEntry entry = getConstantMap().get(name);
if (entry == null) {
throw context.runtime.newNameError("constant " + getName() + "::" + name + " not defined", name);
}
getConstantMapForWrite().put(name, new ConstantEntry(entry.value, hidden));
}
代码示例来源:origin: org.jruby/jruby-core
private static String formatReceiver(final IRubyObject object) {
if ( object instanceof RubyModule ) {
return ((RubyModule) object).getName();
}
return object.getMetaClass().getRealClass().getName();
}
代码示例来源:origin: org.jruby/jruby-complete
private static String formatReceiver(final IRubyObject object) {
if ( object instanceof RubyModule ) {
return ((RubyModule) object).getName();
}
return object.getMetaClass().getRealClass().getName();
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public void checkValidBindTargetFrom(ThreadContext context, RubyModule originModule) throws RaiseException {
if (!this.hasModuleInHierarchy(originModule)) {
if (originModule instanceof MetaClass) {
throw context.runtime.newTypeError("can't bind singleton method to a different class");
} else {
throw context.runtime.newTypeError("bind argument must be an instance of " + originModule.getName());
}
}
}
代码示例来源:origin: org.jruby/jruby-core
public void checkValidBindTargetFrom(ThreadContext context, RubyModule originModule) throws RaiseException {
// Module methods can always be transplanted
if (!originModule.isModule() && !hasModuleInHierarchy(originModule)) {
if (originModule instanceof MetaClass) {
throw context.runtime.newTypeError("can't bind singleton method to a different class");
} else {
throw context.runtime.newTypeError("bind argument must be an instance of " + originModule.getName());
}
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public IRubyObject fetchConstant(String name, boolean includePrivate) {
assert IdUtil.isConstant(name);
ConstantEntry entry = constantEntryFetch(name);
if (entry == null) return null;
if (entry.hidden && !includePrivate) {
throw getRuntime().newNameError("private constant " + getName() + "::" + name + " referenced", name);
}
return entry.value;
}
代码示例来源:origin: org.jruby/jruby-complete
public void checkValidBindTargetFrom(ThreadContext context, RubyModule originModule) throws RaiseException {
// Module methods can always be transplanted
if (!originModule.isModule() && !hasModuleInHierarchy(originModule)) {
if (originModule instanceof MetaClass) {
throw context.runtime.newTypeError("can't bind singleton method to a different class");
} else {
throw context.runtime.newTypeError("bind argument must be an instance of " + originModule.getName());
}
}
}
代码示例来源: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.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: org.jruby/jruby-core
public IRubyObject removeClassVariable(String name) {
String javaName = validateClassVariable(name);
IRubyObject value;
if ((value = deleteClassVariable(javaName)) != null) {
return value;
}
if (isClassVarDefined(javaName)) {
throw cannotRemoveError(javaName);
}
throw getRuntime().newNameError("class variable " + javaName + " not defined for " + getName(), javaName);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public IRubyObject removeClassVariable(String name) {
String javaName = validateClassVariable(name);
IRubyObject value;
if ((value = deleteClassVariable(javaName)) != null) {
return value;
}
if (isClassVarDefined(javaName)) {
throw cannotRemoveError(javaName);
}
throw getRuntime().newNameError("class variable " + javaName + " not defined for " + getName(), javaName);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public IRubyObject removeClassVariable(String name) {
String javaName = validateClassVariable(name);
IRubyObject value;
if ((value = deleteClassVariable(javaName)) != null) {
return value;
}
if (isClassVarDefined(javaName)) {
throw cannotRemoveError(javaName);
}
throw getRuntime().newNameError("class variable " + javaName + " not defined for " + getName(), javaName);
}
代码示例来源:origin: org.jruby/jruby-complete
public IRubyObject removeClassVariable(String name) {
String javaName = validateClassVariable(name);
IRubyObject value;
if ((value = deleteClassVariable(javaName)) != null) {
return value;
}
if (isClassVarDefined(javaName)) {
throw cannotRemoveError(javaName);
}
throw getRuntime().newNameError("class variable " + javaName + " not defined for " + getName(), javaName);
}
内容来源于网络,如有侵权,请联系作者删除!