package com.project.common.core.domain; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.project.common.core.absclasses.BaseTreeNode; import lombok.Data; import java.util.Objects; @Data public class TreeNode extends BaseTreeNode { private static final long serialVersionUID = 1L; private String title; @JsonSerialize(using = ToStringSerializer.class) private Long key; @JsonSerialize(using = ToStringSerializer.class) private Long value; public TreeNode() { } public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj == null) { return false; } else { TreeNode other = (TreeNode)obj; return Objects.equals(this.getId(), other.getId()); } } public int hashCode() { return Objects.hash(new Object[]{this.id, this.parentId}); } public String toString() { return "TreeNode(title=" + this.getTitle() + ", key=" + this.getKey() + ", value=" + this.getValue() + ")"; } }