@JRubyMethod(name = {"==", "eql?"}) public IRubyObject op_equal(IRubyObject other) { return other instanceof JavaAccessibleObject && accessibleObject().equals(((JavaAccessibleObject) other).accessibleObject()) ? getRuntime().getTrue() : getRuntime().getFalse(); }
@JRubyMethod(name = {"==", "eql?"}) public RubyBoolean op_equal(final IRubyObject other) { return RubyBoolean.newBoolean(getRuntime(), equals(other)); }
@JRubyMethod public RubyFixnum hash() { return getRuntime().newFixnum(hashCode()); }
@JRubyMethod(name = {"to_s", "to_string"}) public RubyString to_string() { return getRuntime().newString( toString() ); }
boolean same(final JavaAccessibleObject that) { if ( this == that ) return true; return this.accessibleObject() == that.accessibleObject(); }
public static RubyClass createJavaFieldClass(Ruby runtime, RubyModule javaModule) { // TODO: NOT_ALLOCATABLE_ALLOCATOR is probably ok here, since we don't intend for people to monkey with // this type and it can't be marshalled. Confirm. JRUBY-415 RubyClass result = javaModule.defineClassUnder("JavaField", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); JavaAccessibleObject.registerRubyMethods(runtime, result); result.defineAnnotatedMethods(JavaField.class); return result; }
@JRubyMethod(name = "equal?") public RubyBoolean same(final IRubyObject other) { final boolean same = other instanceof JavaAccessibleObject && same((JavaAccessibleObject) other); return same ? getRuntime().getTrue() : getRuntime().getFalse(); }
boolean same(final JavaAccessibleObject that) { if ( this == that ) return true; return this.accessibleObject() == that.accessibleObject(); }
public static RubyClass createJavaFieldClass(Ruby runtime, RubyModule javaModule) { // TODO: NOT_ALLOCATABLE_ALLOCATOR is probably ok here, since we don't intend for people to monkey with // this type and it can't be marshalled. Confirm. JRUBY-415 RubyClass result = javaModule.defineClassUnder("JavaField", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); JavaAccessibleObject.registerRubyMethods(runtime, result); result.defineAnnotatedMethods(JavaField.class); return result; }
@JRubyMethod(name = {"to_s", "to_string"}) public RubyString to_string() { return getRuntime().newString( toString() ); }
@JRubyMethod(name = "equal?") public RubyBoolean same(final IRubyObject other) { final boolean same = other instanceof JavaAccessibleObject && same((JavaAccessibleObject) other); return same ? getRuntime().getTrue() : getRuntime().getFalse(); }
@JRubyMethod(name = {"==", "eql?"}) public IRubyObject op_equal(IRubyObject other) { return other instanceof JavaAccessibleObject && accessibleObject().equals(((JavaAccessibleObject) other).accessibleObject()) ? getRuntime().getTrue() : getRuntime().getFalse(); }
public boolean equals(Object other) { return other instanceof JavaAccessibleObject && this.accessibleObject() == ((JavaAccessibleObject) other).accessibleObject(); }
@JRubyMethod public RubyFixnum hash() { return getRuntime().newFixnum(hashCode()); }
@JRubyMethod(name = "equal?") public IRubyObject same(IRubyObject other) { return getRuntime().newBoolean(equals(other)); }
public static RubyClass createJavaFieldClass(Ruby runtime, RubyModule javaModule) { // TODO: NOT_ALLOCATABLE_ALLOCATOR is probably ok here, since we don't intend for people to monkey with // this type and it can't be marshalled. Confirm. JRUBY-415 RubyClass result = javaModule.defineClassUnder("JavaField", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); JavaAccessibleObject.registerRubyMethods(runtime, result); result.defineAnnotatedMethods(JavaField.class); return result; }
@JRubyMethod public IRubyObject declaring_class() { Class<?> clazz = ((Member) accessibleObject()).getDeclaringClass(); if ( clazz != null ) return JavaClass.get(getRuntime(), clazz); return getRuntime().getNil(); }
public boolean equals(Object other) { return other instanceof JavaAccessibleObject && this.accessibleObject() == ((JavaAccessibleObject) other).accessibleObject(); }
@JRubyMethod public RubyFixnum hash() { return getRuntime().newFixnum(hashCode()); }
@JRubyMethod(name = {"==", "eql?"}) public RubyBoolean op_equal(final IRubyObject other) { return RubyBoolean.newBoolean(getRuntime(), equals(other)); }