1 25 26 package org.objectweb.jonas.webapp.jonasadmin.common; 27 28 import java.util.Comparator ; 29 30 import javax.management.ObjectName ; 31 32 35 public class ObjectNameComparator implements Comparator { 36 37 39 public int compare(Object p_O1, Object p_O2) { 40 ObjectName o1 = (ObjectName ) p_O1; 42 ObjectName o2 = (ObjectName ) p_O2; 43 int iRet = o1.getDomain().compareToIgnoreCase(o2.getDomain()); 44 if (iRet == 0) { 45 iRet = o1.getDomain().compareTo(o2.getDomain()); 46 if (iRet == 0) { 47 iRet = o1.toString().compareToIgnoreCase(o2.toString()); 48 } 49 } 50 return iRet; 51 } 52 53 public boolean equals(Object p_Obj) { 54 if (p_Obj instanceof ObjectName ) { 55 return (compare(this, p_Obj) == 0); 56 } 57 return false; 58 } 59 } | Popular Tags |