1 23 24 package com.sun.appserv.management.util.jmx; 25 26 import javax.management.MBeanOperationInfo ; 27 28 import com.sun.appserv.management.util.jmx.stringifier.MBeanOperationInfoStringifier; 29 import com.sun.appserv.management.util.jmx.stringifier.MBeanFeatureInfoStringifierOptions; 30 31 32 35 public final class MBeanOperationInfoComparator 36 implements java.util.Comparator <MBeanOperationInfo > 37 { 38 private static final MBeanOperationInfoStringifier OPERATION_INFO_STRINGIFIER = 39 new MBeanOperationInfoStringifier( new MBeanFeatureInfoStringifierOptions( false, ",") ); 40 41 42 public static final MBeanOperationInfoComparator 43 INSTANCE = new MBeanOperationInfoComparator(); 44 45 private MBeanOperationInfoComparator() {} 46 47 public int 48 compare( final MBeanOperationInfo info1, final MBeanOperationInfo info2 ) 49 { 50 final MBeanOperationInfoStringifier sf = OPERATION_INFO_STRINGIFIER; 51 52 int c = info1.getName().compareTo( info2.getName() ); 56 if ( c == 0 ) 57 { 58 c = info1.getSignature().length - info2.getSignature().length; 60 if ( c == 0 ) 61 { 62 c = sf.getSignature( info1 ).compareTo( sf.getSignature( info2 ) ); 64 } 65 66 } 67 68 return( c ); 69 } 70 71 public boolean 72 equals( Object other ) 73 { 74 return( other instanceof MBeanOperationInfoComparator ); 75 } 76 } 77 78 79 80 81 | Popular Tags |