@Override void install(final RubyModule proxy) { if ( Modifier.isPublic(field.getModifiers()) ) { proxy.addMethod(name, new InstanceFieldSetter(name, proxy, field)); } } }
@Override public final IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg) { try { Object value = arg.toJava(field.getType()); field.set(retrieveTarget(self), value); } catch (IllegalAccessException ex) { return handleSetException(context.runtime, ex); } catch (IllegalArgumentException ex) { return handleSetException(context.runtime, ex); } return arg; }
Field field = ((InstanceFieldSetter) method).getField();
Field field = ((InstanceFieldSetter) method).getField();
void install(RubyModule proxy) { if (Modifier.isPublic(field.getModifiers())) { proxy.addMethod(name, new InstanceFieldSetter(name, proxy, field)); } } }
@Override public final IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg) { try { Object value = arg.toJava(field.getType()); field.set(retrieveTarget(self), value); } catch (IllegalAccessException ex) { return handleSetException(context.runtime, ex); } catch (IllegalArgumentException ex) { return handleSetException(context.runtime, ex); } return arg; }
@Override void install(final RubyModule proxy) { if ( Modifier.isPublic(field.getModifiers()) ) { proxy.addMethod(name, new InstanceFieldSetter(name, proxy, field)); } } }
void install(RubyModule proxy) { if (Modifier.isPublic(field.getModifiers())) { proxy.addMethod(name, new InstanceFieldSetter(name, proxy, field)); } } }
throw context.runtime.newSecurityError("Cannot change final field '" + field.getName() + "'"); module.addMethod(asName + "=", new InstanceFieldSetter(key, module, field));
throw context.runtime.newSecurityError("Cannot change final field '" + field.getName() + "'"); module.addMethod(asName + "=", new InstanceFieldSetter(key, module, field));
throw context.runtime.newSecurityError("Cannot change final field '" + field + "'"); target.addMethod(asName + '=', new InstanceFieldSetter(fieldName, target, field));
throw context.runtime.newSecurityError("Cannot change final field '" + field + "'"); target.addMethod(asName + '=', new InstanceFieldSetter(fieldName, target, field));