View Javadoc

1   package se.citerus.dddsample.domain.shared.experimental;
2   
3   /**
4    * A value object.
5    *
6    */
7   public interface ValueObject<T> {
8   
9     /**
10     * Value objects compare by the values of their attributes, they don't have an identity.
11     *
12     * @param other The other value object.
13     * @return <code>true</code> if the given value object's and this value object's attributes are the same.
14     */
15    boolean sameValueAs(T other);
16  
17    /**
18     * Value objects can be freely copied.
19     *
20     * @return A safe, deep copy of this value object.
21     */
22    T copy();
23  
24  }