se.citerus.dddsample.domain.model.location
Class Location

java.lang.Object
  extended by se.citerus.dddsample.domain.model.location.Location
All Implemented Interfaces:
Entity<Location>

public final class Location
extends java.lang.Object
implements Entity<Location>

A location is our model is stops on a journey, such as cargo origin or destination, or carrier movement endpoints. It is uniquely identified by a UN Locode.


Field Summary
static Location UNKNOWN
          Special Location object that marks an unknown location.
 
Method Summary
 boolean equals(java.lang.Object object)
           
 int hashCode()
           
 java.lang.String name()
           
 boolean sameIdentityAs(Location other)
          Entities compare by identity, not by attributes.
 java.lang.String toString()
           
 UnLocode unLocode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN

public static final Location UNKNOWN
Special Location object that marks an unknown location.

Method Detail

unLocode

public UnLocode unLocode()
Returns:
UN Locode for this location.

name

public java.lang.String name()
Returns:
Actual name of this location, e.g. "Stockholm".

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object
Parameters:
object - to compare
Returns:
Since this is an entiy this will be true iff UN locodes are equal.

sameIdentityAs

public boolean sameIdentityAs(Location other)
Description copied from interface: Entity
Entities compare by identity, not by attributes.

Specified by:
sameIdentityAs in interface Entity<Location>
Parameters:
other - The other entity.
Returns:
true if the identities are the same, regardles of other attributes.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
Hash code of UN locode.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2009. All Rights Reserved.