重写equals、hashCode、toString方法

public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof LearningTaskDto)) {
            return false;
        } else {
            LearningTaskDto other = (LearningTaskDto)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                Object this$assignUsers = this.getAssignUsers();
                Object other$assignUsers = other.getAssignUsers();
                if (this$assignUsers == null) {
                    if (other$assignUsers != null) {
                        return false;
                    }
                } else if (!this$assignUsers.equals(other$assignUsers)) {
                    return false;
                }

                Object this$courseIds = this.getCourseIds();
                Object other$courseIds = other.getCourseIds();
                if (this$courseIds == null) {
                    if (other$courseIds != null) {
                        return false;
                    }
                } else if (!this$courseIds.equals(other$courseIds)) {
                    return false;
                }

                return true;
            }
        }
    }
 
public int hashCode() {
        int PRIME = true;
        int result = 1;
        Object $assignUsers = this.getAssignUsers();
        int result = result * 59 + ($assignUsers == null ? 43 : $assignUsers.hashCode());
        Object $courseIds = this.getCourseIds();
        result = result * 59 + ($courseIds == null ? 43 : $courseIds.hashCode());
        return result;
    }

    public String toString() {
        return "LearningTaskDto(assignUsers=" + this.getAssignUsers() + ", courseIds=" + this.getCourseIds() + ")";
    }

 

posted @ 2021-08-19 10:45  二次元的程序猿  阅读(195)  评论(0编辑  收藏  举报