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.User; 35 36 43 public class UserComparator implements Comparator ,Serializable { 44 45 48 private static final long serialVersionUID = 3978702878976325686L; 49 50 56 public int compare(Object o1, Object o2) { 57 58 try { 59 User u1 = (User) o1; 60 User u2 = (User) o2; 61 62 return u1.getNickname().compareTo(u2.getNickname()); 63 64 } catch (Exception e) { 65 throw new BlogunityRuntimeException(I18NStatusFactory.create( 66 I18N.ERRORS.UNABLE_TO_COMPARE, new String []{"users"}, e)); 67 } 68 69 } 70 71 } | Popular Tags |