au.gov.tas.dpiwe.mr.bean
Class BeanMethodComparator
java.lang.Object
au.gov.tas.dpiwe.mr.bean.BeanMethodComparator
- All Implemented Interfaces:
- Comparator
public class BeanMethodComparator
- extends Object
- implements Comparator
A comparator which orders bean methods on their names, but placing the
primary key getter and setter methods first and second respectively.
- Since:
- Mr Architecture 1.8
- Version:
- 1.0.0.1
- Author:
- Kade Hansson
primaryKeyGetter
protected Method primaryKeyGetter
primaryKeySetter
protected Method primaryKeySetter
BeanMethodComparator
public BeanMethodComparator(Method primaryKeyGetter,
Method primaryKeySetter)
- Construct a new bean method comparator.
- Parameters:
primaryKeyGetter - method to place first in the ordering.primaryKeySetter - method to place second in the ordering.
compare
public int compare(Object first,
Object second)
- Compares two bean methods.
- Specified by:
compare in interface Comparator
- Parameters:
first - the first bean method.second - the second bean method.
- Returns:
- -1 if first before second, 0 if first equals second, or 1 if first after second.
equals
public boolean equals(Object other)
- Compares two bean method comparators.
- Specified by:
equals in interface Comparator- Overrides:
equals in class Object
- Returns:
- true.