1 25 26 package com.j2biz.blogunity.util; 27 28 import java.io.Serializable ; 29 import java.util.Comparator ; 30 31 import com.j2biz.blogunity.exception.BlogunityRuntimeException; 32 import com.j2biz.blogunity.i18n.I18N; 33 import com.j2biz.blogunity.i18n.I18NStatusFactory; 34 import com.j2biz.blogunity.pojo.Userpic; 35 36 43 public class UserpicComparator implements Comparator ,Serializable { 44 45 48 private static final long serialVersionUID = 3906927889440977716L; 49 50 55 public int compare(Object o1, Object o2) { 56 try { 57 Userpic c1 = (Userpic) o1; 58 Userpic c2 = (Userpic) o2; 59 60 Long id1 = c1.getId(); 61 Long id2 = c2.getId(); 62 63 if (id1 == null) return 1; 64 if (id2 == null) return -1; 65 66 return id1.compareTo(id2); 67 68 } catch (Exception e) { 69 throw new BlogunityRuntimeException(I18NStatusFactory.create( 70 I18N.ERRORS.UNABLE_TO_COMPARE, new String []{"userpics"}, e)); 71 } 72 } 73 } | Popular Tags |