You cannot set the "this" link.
Since you cannot set the "this" link, the best you can do is get the object this way
public void update(String newParams) {
and then set all the βstateβ of the class that it was supposed to replace
this.setValue1(fetchedObject.getValue1()); this.setvalue2(fetchedObject.getValue2()); ...
The optimization is to set fields directly.
this.field1 = fetchedObject.field1; this.field2 = fetchedObject.field2; ...
however, with this optimization, you must ensure that inaccurate field copying is appropriate.
source share