View Javadoc

1   package se.citerus.dddsample.domain.shared.experimental;
2   
3   /**
4    * An entity, as explained in the DDD book.
5    *
6    */
7   public interface Entity<T,ID> {
8   
9     /**
10     * Entities compare by identity, not by attributes.
11     *
12     * @param other The other entity.
13     * @return true if the identities are the same, regardles of other attributes.
14     */
15    boolean sameIdentityAs(T other);
16  
17    /**
18     * Entities have an identity.
19     *
20     * @return The identity of this entity.
21     */
22    ID identity();
23  
24  }