echopointng.util.reflect
Class ReflectionKit.MethodComparator

java.lang.Object
  extended by echopointng.util.reflect.ReflectionKit.MethodComparator
All Implemented Interfaces:
java.util.Comparator
Direct Known Subclasses:
ReflectionKit.ClassMethodComparator
Enclosing class:
ReflectionKit

public static class ReflectionKit.MethodComparator
extends java.lang.Object
implements java.util.Comparator

A Comparator that can be used when comparing and sorting Method objects by name, modifier and parameter liist order. If they end the same after that they are sorted in declaring class order with the most specific class first.

In short it sorts in "Method / Class" order.


Constructor Summary
ReflectionKit.MethodComparator()
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
           
protected  int compareNonNullMethods(java.lang.reflect.Method m1, java.lang.reflect.Method m2)
          Compares 2 non null Methods according to name, modifier and parameter types.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

ReflectionKit.MethodComparator

public ReflectionKit.MethodComparator()
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Specified by:
compare in interface java.util.Comparator

compareNonNullMethods

protected int compareNonNullMethods(java.lang.reflect.Method m1,
                                    java.lang.reflect.Method m2)
Compares 2 non null Methods according to name, modifier and parameter types.

Parameters:
m1 - - the first method
m2 - - the second method
Returns:
-1, 0 or 1 according to Comparator