Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package konditer.client.bean; import java.util.Date; import java.util.Objects; import org.springframework.stereotype.Component; /** * * @author ALF */ @Component //@XmlRootElement(name = "genId") //@XmlAccessorType(value = XmlAccessType.FIELD) public final class GenId { private String tableName; private int rowCount; private Date timestamp; public GenId() { this.tableName = null; this.rowCount = 0; this.timestamp = null; } public GenId(GenId genId) { this.tableName = genId.getTableName(); this.rowCount = genId.getRowCount(); this.timestamp = genId.getTimestamp(); } public GenId(String tableName, int rowCount, Date timestamp) { this.tableName = tableName; this.rowCount = rowCount; this.timestamp = timestamp; } public void setTableName(String tableName) { this.tableName = tableName; } public void setTimestamp(Date timestamp) { this.timestamp = timestamp; } public void setRowCount(int rowCount) { this.rowCount = rowCount; } public String getTableName() { return this.tableName; } public int getRowCount() { return this.rowCount; } public Date getTimestamp() { return this.timestamp; } @Override public String toString() { return "GenId{" + "tableName=" + tableName + ", rowCount=" + rowCount + ", timestamp=" + timestamp + "}"; } @Override public int hashCode() { int hash = 7; hash = 97 * hash + Objects.hashCode(this.tableName); hash = 97 * hash + Objects.hashCode(this.rowCount); return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final GenId other = (GenId) obj; if (!Objects.equals(this.tableName, other.tableName)) { return false; } return Objects.equals(this.rowCount, other.rowCount); } }