se.citerus.dddsample.domain.model.cargo
Class RouteSpecification

java.lang.Object
  extended by se.citerus.dddsample.domain.shared.AbstractSpecification<Itinerary>
      extended by se.citerus.dddsample.domain.model.cargo.RouteSpecification
All Implemented Interfaces:
java.io.Serializable, Specification<Itinerary>, ValueObject<RouteSpecification>

public class RouteSpecification
extends AbstractSpecification<Itinerary>
implements ValueObject<RouteSpecification>

Route specification. Describes where a cargo orign and destination is, and the arrival deadline.

See Also:
Serialized Form

Constructor Summary
RouteSpecification(Location origin, Location destination, java.util.Date arrivalDeadline)
           
 
Method Summary
 java.util.Date arrivalDeadline()
           
 Location destination()
           
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 boolean isSatisfiedBy(Itinerary itinerary)
          Check if t is satisfied by the specification.
 Location origin()
           
 boolean sameValueAs(RouteSpecification other)
          Value objects compare by the values of their attributes, they don't have an identity.
 
Methods inherited from class se.citerus.dddsample.domain.shared.AbstractSpecification
and, not, or
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RouteSpecification

public RouteSpecification(Location origin,
                          Location destination,
                          java.util.Date arrivalDeadline)
Parameters:
origin - origin location - can't be the same as the destination
destination - destination location - can't be the same as the origin
arrivalDeadline - arrival deadline
Method Detail

origin

public Location origin()
Returns:
Specified origin location.

destination

public Location destination()
Returns:
Specfied destination location.

arrivalDeadline

public java.util.Date arrivalDeadline()
Returns:
Arrival deadline.

isSatisfiedBy

public boolean isSatisfiedBy(Itinerary itinerary)
Description copied from class: AbstractSpecification
Check if t is satisfied by the specification.

Specified by:
isSatisfiedBy in interface Specification<Itinerary>
Specified by:
isSatisfiedBy in class AbstractSpecification<Itinerary>
Parameters:
itinerary - Object to test.
Returns:
true if t satisfies the specification.

sameValueAs

public boolean sameValueAs(RouteSpecification other)
Description copied from interface: ValueObject
Value objects compare by the values of their attributes, they don't have an identity.

Specified by:
sameValueAs in interface ValueObject<RouteSpecification>
Parameters:
other - The other value object.
Returns:
true if the given value object's and this value object's attributes are the same.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2009. All Rights Reserved.