au.gov.tas.dpiwe.mr.relationship
Class EntityBeanComparator

java.lang.Object
  extended by au.gov.tas.dpiwe.mr.relationship.EntityBeanComparator
All Implemented Interfaces:
Comparator

public class EntityBeanComparator
extends Object
implements Comparator

A comparator which orders entity beans based on their primary key values.

Since:
Mr Architecture 2.0
Version:
1.0.0.0
Author:
Kade Hansson

Field Summary
protected  Container container
           
 
Constructor Summary
EntityBeanComparator(Container container)
          Construct a entity bean comparator.
 
Method Summary
 int compare(Object first, Object second)
          Compares two entity beans.
 boolean equals(Object other)
          Compares two entity bean comparators.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

container

protected Container container
Constructor Detail

EntityBeanComparator

public EntityBeanComparator(Container container)
Construct a entity bean comparator.

Parameters:
container - a container which knows the primary key getter method of the beans.
Method Detail

compare

public int compare(Object first,
                   Object second)
Compares two entity beans.

Specified by:
compare in interface Comparator
Parameters:
first - the first bean.
second - the second bean.
Returns:
-1 if first before second, 0 if first equals second, or 1 if first after second.
Throws:
EJBException - if the beans are of different types or have differing implementations.

equals

public boolean equals(Object other)
Compares two entity bean comparators.

Specified by:
equals in interface Comparator
Overrides:
equals in class Object
Returns:
true.