removed Property.valueChanged
This commit is contained in:
parent
b99fb7d229
commit
6f66cc060c
@ -6,7 +6,6 @@ import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@ -51,12 +50,9 @@ public class Property<T> implements IProperty<T> {
|
||||
@Nullable
|
||||
private State<T> state = null;
|
||||
|
||||
private boolean valueChanged = false;
|
||||
|
||||
public void update(@Nullable final State<T> state) {
|
||||
this.lastState = this.state;
|
||||
this.state = state;
|
||||
this.valueChanged = (lastState == null) == (state == null) && (lastState == null || Objects.equals(lastState.getValue(), state.getValue()));
|
||||
this.onStateSet.accept(this);
|
||||
}
|
||||
|
||||
|
||||
@ -28,14 +28,11 @@ public class PropertyDto<T> implements IProperty<T> {
|
||||
@Nullable
|
||||
private final State<T> state;
|
||||
|
||||
private final boolean valueChanged;
|
||||
|
||||
public PropertyDto(@NonNull final Property<T> property) {
|
||||
this.id = property.getId();
|
||||
this.type = property.getType();
|
||||
this.state = property.getState();
|
||||
this.lastState = property.getLastState();
|
||||
this.valueChanged = property.isValueChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -96,9 +96,6 @@ public class PropertyService {
|
||||
private void onStateSet(@NonNull final Property<?> property) {
|
||||
final PropertyDto<?> dto = toDto(property);
|
||||
log.debug("Property updated: {}", dto);
|
||||
if (dto.isValueChanged()) {
|
||||
log.info("Property changed: {}", dto);
|
||||
}
|
||||
applicationEventPublisher.publishEvent(dto);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user