
fr.ird.observe.dto.DtoPropertyModification Maven / Gradle / Ivy
package fr.ird.observe.dto;
/*-
* #%L
* ObServe Toolkit :: Dto
* %%
* Copyright (C) 2017 - 2021 Ultreia.io
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* .
* #L%
*/
import java.io.Serializable;
import java.util.Objects;
/**
* Represents a modification on a property of a {@link IdDto}.
*
* Created on 30/08/2020.
*
* @author Tony Chemit - [email protected]
* @since 8.1.0
*/
public class DtoPropertyModification implements ObserveDto {
private final String id;
private final String propertyName;
private final Serializable newValue;
public DtoPropertyModification(IdDto dto, String propertyName) {
this(Objects.requireNonNull(dto).getId(), propertyName, dto.get(propertyName));
}
public DtoPropertyModification(String id, String propertyName, Serializable newValue) {
this.id = id;
this.propertyName = propertyName;
this.newValue = newValue;
}
public String getId() {
return id;
}
public String getPropertyName() {
return propertyName;
}
public Serializable getNewValue() {
return newValue;
}
}