import java.io.Serializable; import java.time.LocalDateTime; import java.util.Objects; public abstract class AankoopDocument implements Comparable, Serializable { private static final long serialVersionUID = 2303282081949918657L; private static int teller = 0; private String aankoopID; private LocalDateTime datumTijd; private String prefix; public AankoopDocument(String prefix) { teller++; this.prefix = prefix; this.aankoopID = prefix + teller; this.datumTijd = LocalDateTime.now(); } public String getAankoopID() { return aankoopID; } public LocalDateTime getDatumTijd() { return datumTijd; } public String getPrefix() { return prefix; } public abstract String getUitvoerder(); public String toString(){ return this.aankoopID + ";" + prefix + ";" + datumTijd.toString() + ";" + this.getUitvoerder(); } @Override public int hashCode() { int hash = 3; return hash; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AankoopDocument other = (AankoopDocument) obj; if (!Objects.equals(this.aankoopID, other.aankoopID)) { return false; } return true; } @Override public int compareTo(AankoopDocument other) { return this.datumTijd.compareTo(other.datumTijd); } }