@ParameterList({"self", "srcFieldName", "dstObj", "dstFieldName"}) public static _Object move( _Object self, StringValue srcFieldName, _Object dstObj, StringValue dstFieldName) { _Object srcObj = self; if (dstFieldName == null) dstFieldName = srcFieldName; // same name _Object childObj = srcObj.getChild(srcFieldName.getValue()); srcObj.detachOwnedChild(childObj); dstObj.setField(dstFieldName.getValue(), childObj, true); return self; }
@ParameterList({"self", "name", "child"}) public static _Object get(_Object self, StringValue name) { _Object value = self.getChild(name.getValue()); return value; }
@ParameterList({"self", "name", "value"}) public static _Object set(_Object self, StringValue name, _Object value) { boolean canIOwn = value.getScope() == ObjectScope.ExecutionContext; self.setField(name.getValue(), value, canIOwn); return null; }
@ParameterList({"self", "name", "child"}) public static _Object forceOwn(_Object self, StringValue name, _Object child) { if (child.hasOwner()) child.getOwner().detachOwnedChild(child); self.setField(name.getValue(), child, true); return self; }
@ParameterList({"self", "owner", "name"}) public static _Object attachTo(_Object self, _Object owner, StringValue name) { if (self.hasOwner()) self.getOwner().detachOwnedChild(self); self.attachToOwner(owner, name.getValue()); return self; }