mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-04 20:28:00 +08:00
PL-8152 Compare property values considering reference equality for Instance subclasses instead of usual equals
This commit is contained in:
parent
768e11e003
commit
2a9589e3e6
@ -120,14 +120,13 @@ public abstract class AbstractInstance implements Instance {
|
||||
/**
|
||||
* Set value to property in instance
|
||||
*
|
||||
* @deprecated For internal use only. Parameter checkEquals now does not affect logic. Use {@link #setValue(String, Object)}
|
||||
* For internal use only. Use {@link #setValue(String, Object)}
|
||||
*
|
||||
* @param name property name
|
||||
* @param value value
|
||||
* @param checkEquals check equals for previous and new value.
|
||||
* If flag is true and objects equals, then setter will not be invoked
|
||||
*/
|
||||
@Deprecated
|
||||
public void setValue(String name, Object value, boolean checkEquals) {
|
||||
Object oldValue = getValue(name);
|
||||
if ((!checkEquals) || (!InstanceUtils.propertyValueEquals(oldValue, value))) {
|
||||
|
@ -19,13 +19,13 @@ package com.haulmont.cuba.core.entity;
|
||||
import com.haulmont.chile.core.annotations.MetaProperty;
|
||||
import com.haulmont.chile.core.model.MetaClass;
|
||||
import com.haulmont.chile.core.model.impl.AbstractInstance;
|
||||
import com.haulmont.chile.core.model.utils.InstanceUtils;
|
||||
import com.haulmont.cuba.core.entity.annotation.SystemLevel;
|
||||
import com.haulmont.cuba.core.global.AppBeans;
|
||||
import com.haulmont.cuba.core.global.Metadata;
|
||||
import com.haulmont.cuba.core.global.UuidProvider;
|
||||
import com.haulmont.cuba.core.sys.CubaEnhanced;
|
||||
import com.haulmont.cuba.core.sys.CubaEnhancingDisabled;
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -78,7 +78,7 @@ public abstract class AbstractNotPersistentEntity
|
||||
@Override
|
||||
public void setValue(String property, Object obj, boolean checkEquals) {
|
||||
Object oldValue = getValue(property);
|
||||
if ((!checkEquals) || (!ObjectUtils.equals(oldValue, obj))) {
|
||||
if ((!checkEquals) || (!InstanceUtils.propertyValueEquals(oldValue, obj))) {
|
||||
getMethodsCache().invokeSetter(this, property, obj);
|
||||
if (!(this instanceof CubaEnhanced)) {
|
||||
propertyChanged(property, oldValue, obj);
|
||||
|
@ -19,10 +19,10 @@ package com.haulmont.cuba.core.entity;
|
||||
|
||||
import com.haulmont.chile.core.model.MetaClass;
|
||||
import com.haulmont.chile.core.model.impl.AbstractInstance;
|
||||
import com.haulmont.chile.core.model.utils.InstanceUtils;
|
||||
import com.haulmont.cuba.core.entity.annotation.SystemLevel;
|
||||
import com.haulmont.cuba.core.global.UuidProvider;
|
||||
import com.haulmont.cuba.core.sys.CubaEnhancingDisabled;
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@ -98,7 +98,7 @@ public class KeyValueEntity
|
||||
@Override
|
||||
public void setValue(String name, Object value, boolean checkEquals) {
|
||||
Object oldValue = getValue(name);
|
||||
if ((!checkEquals) || (!ObjectUtils.equals(oldValue, value))) {
|
||||
if ((!checkEquals) || (!InstanceUtils.propertyValueEquals(oldValue, value))) {
|
||||
properties.put(name, value);
|
||||
propertyChanged(name, oldValue, value);
|
||||
}
|
||||
@ -150,4 +150,4 @@ public class KeyValueEntity
|
||||
id = "?(" + uuid + ")";
|
||||
return "sys$KeyValueEntity-" + id;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user