1 4 package org.jahia.content.comparators; 5 6 import org.jahia.services.pages.ContentPage; 7 import org.jahia.params.ParamBean; 8 9 import java.util.Comparator ; 10 11 18 public class PageByTitleComparator implements Comparator { 19 private ParamBean paramBean; 20 21 public PageByTitleComparator(ParamBean paramBean) { 22 this.paramBean = paramBean; 23 } 24 private PageByTitleComparator() { 25 } 26 60 public int compare(Object o1, Object o2) { 61 62 if(o1 instanceof ContentPage && o2 instanceof ContentPage) { 63 ContentPage page1 = (ContentPage) o1; 64 ContentPage page2 = (ContentPage) o2; 65 return page1.getTitle(paramBean).compareTo(page2.getTitle(paramBean)); 66 } 67 return 0; 68 } 69 } 70 | Popular Tags |