fix warnings

This commit is contained in:
Anton Romanov 2019-06-22 13:50:15 +04:00
parent df1bf873ff
commit 3267138524

View File

@ -5,7 +5,9 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Objects;
@MappedSuperclass
public abstract class BaseEntity implements Serializable, Comparable {
@ -16,14 +18,6 @@ public abstract class BaseEntity implements Serializable, Comparable {
@Version
private Integer version;
protected BaseEntity() {
}
public BaseEntity(Integer id, Integer version) {
this.id = id;
this.version = version;
}
public Integer getId() {
return id;
}
@ -48,9 +42,7 @@ public abstract class BaseEntity implements Serializable, Comparable {
return false;
}
BaseEntity other = (BaseEntity) obj;
if (id == null) {
return other.id == null;
} else return id.equals(other.id);
return Objects.equals(id, other.id);
}
@Override
@ -70,7 +62,7 @@ public abstract class BaseEntity implements Serializable, Comparable {
}
@Override
public int compareTo(Object o) {
public int compareTo(@NotNull Object o) {
return id != null ? id.compareTo(((BaseEntity) o).getId()) : -1;
}