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