1 25 26 package org.objectweb.jonas.webapp.jonasadmin.common; 27 28 import org.objectweb.jonas.webapp.jonasadmin.common.ModuleItem; 29 import java.util.Comparator ; 30 36 public class ModuleItemByName implements Comparator { 37 39 public int compare(Object pO1, Object pO2) { 40 ModuleItem oContainer1 = (ModuleItem) pO1; 41 ModuleItem oContainer2 = (ModuleItem) pO2; 42 if ((oContainer1.getName() == null) || (oContainer2.getName() == null)) { 43 if ((oContainer1.getName() == null) && (oContainer2.getName() == null)) { 44 return 0; 45 } else if ((oContainer1.getName() == null) && (oContainer2.getName() != null)) { 46 return 1; 47 } else { 48 return -1; 49 } 50 } 51 return oContainer1.getName().compareToIgnoreCase(oContainer2.getName()); 52 } 53 54 public boolean equals(Object pObj) { 55 if (pObj instanceof ModuleItem) { 56 return true; 57 } 58 return false; 59 } 60 } | Popular Tags |