package de.ivu.elect.business.system.entity;

import java.util.concurrent.atomic.AtomicLong;

import de.ivu.elect.jee.entity.AbstractNoPersistentEntity;

public class ElectNoPersistentEntity extends AbstractNoPersistentEntity {

  private static final AtomicLong IDS = new AtomicLong(Long.MIN_VALUE);

  private static final long serialVersionUID = 1L;

  private final Long id = IDS.addAndGet(1L);

  @Override
  public Long getId() {
    return id;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    ElectNoPersistentEntity that = (ElectNoPersistentEntity) o;

    return id != null ? id.equals(that.id) : that.id == null;
  }

  @Override
  public int hashCode() {
    return id != null ? id.hashCode() : 0;
  }
}
