realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

updating realm object dynamicly

Open idok595 opened this issue 9 years ago • 2 comments

it is possible to update realm obejct dynamcly? for example let assume that i have 2 realm objects from the same type, this type of obejct has no primary key

objectA - is valid and manges realm object objectB - is not manged but valid realm object,

i want to replace all values inside objectA with values from objectB without knowing the sturectre of this objects, in DynamicRealmObject it is possbile simple itarete all feilds but i think it will be very usefull to have this functionality also in RealmObject

idok595 avatar May 23 '17 16:05 idok595

This can be done with reflection, as long as you use accessor methods instead of fields directly.

Zhuinden avatar May 23 '17 18:05 Zhuinden

@idok595 As @Zhuinden points out, you can use reflection. But reflection on Android is pretty expensive, and that's why we took another route ;-)

kneth avatar Jun 01 '17 07:06 kneth