public VelSetterImpl(UberspectImpl enclosingInstance, VelMethod velmethod) { InitBlock(enclosingInstance); this.vm = velmethod; }
public VelSetterImpl(UberspectImpl enclosingInstance, VelMethod velmethod, String key) { InitBlock(enclosingInstance); this.vm = velmethod; putKey = key; }
/// <summary> Property setter /// </summary> public VelPropertySet getPropertySet(Object obj, String identifier, Object arg, Info i) { Type claz = obj.GetType(); VelPropertySet vs = null; VelMethod vm = null; try { /* * first, we introspect for the set<identifier> setter method */ Object[] params_Renamed = new Object[] { arg }; try { vm = getMethod(obj, "set" + identifier, params_Renamed, i); if (vm == null) { throw new MethodAccessException(); } } catch (MethodAccessException nsme2) { StringBuilder sb = new StringBuilder("set"); sb.Append(identifier); if (Char.IsLower(sb[3])) { sb[3] = Char.ToUpper(sb[3]); } else { sb[3] = Char.ToLower(sb[3]); } vm = getMethod(obj, sb.ToString(), params_Renamed, i); if (vm == null) { throw new MethodAccessException(); } } } catch (MethodAccessException nsme) { /* * right now, we only support the Map interface */ if (typeof(IDictionary).IsAssignableFrom(claz)) { Object[] params_Renamed = new Object[] { new Object(), new Object() }; vm = getMethod(obj, "put", params_Renamed, i); if (vm != null) { return(new VelSetterImpl(this, vm, identifier)); } } } return((vm != null) ? new VelSetterImpl(this, vm) : null); }