Merge branch 'release/5.19.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / input / sortprovider / AbstractDateComparator.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9 package eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider;
10
11 import java.util.Comparator;
12
13 import org.joda.time.DateTime;
14
15 import eu.etaxonomy.cdm.model.common.ICdmBase;
16
17 /**
18 * @author n.hoffmann
19 * @created Dec 14, 2010
20 */
21 public abstract class AbstractDateComparator<T extends ICdmBase> implements Comparator<T>{
22
23 @Override
24 public int compare(T o1, T o2) {
25 if (o1.equals(o2)){
26 return 0;
27 }
28
29 return getDate(o1).compareTo(getDate(o2));
30 };
31
32 protected abstract DateTime getDate(T object);
33 }