EchoPoint API - 3.0.0b5
App Webcontainer

echopoint.util
Class ReflectionKit.MemberClassComparator

java.lang.Object
  extended by echopoint.util.ReflectionKit.MemberClassComparator
All Implemented Interfaces:
Comparator
Direct Known Subclasses:
ReflectionKit.ClassMemberComparator, ReflectionKit.FieldClassComparator, ReflectionKit.MethodClassComparator
Enclosing class:
ReflectionKit

public static class ReflectionKit.MemberClassComparator
extends Object
implements Comparator

A Comparator that can be used when comparing and sorting Member objects by name, modifier and finally declaring class order. NOTE : Member is the base class for Constructor, Field and Method and hence you can sort any of these types with this Comparator.

If the Member's names are the same they are then sorted by modifier and parameters and finally by declaring class with the most specific class first.

In short it sorts in "Member / Modifiers / Parameters / Declaring Class" order.


Constructor Summary
ReflectionKit.MemberClassComparator()
           
 
Method Summary
 int compare(Object o1, Object o2)
           
protected  int compareByConstructor(Constructor c1, Constructor c2)
          The compares the two Constructor values against each other in the following order : The Constructor parameter count The Constructor parameter type
protected  int compareByField(Field f1, Field f2)
          The compares the two Field values against each other in the following order : Field name Field type
protected  int compareByMethod(Method m1, Method m2)
          The compares the two Method values against each other in the following order : Method name Method return type Method parameter count Method parameter types
protected  int compareByModifiers(int modifier1, int modifier2)
          The compares the two Modifier values against each other in the following order public protected abstract final native interface static
 
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.MemberClassComparator

public ReflectionKit.MemberClassComparator()
Method Detail

compare

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

compareByModifiers

protected int compareByModifiers(int modifier1,
                                 int modifier2)
The compares the two Modifier values against each other in the following order
  1. public
  2. protected
  3. abstract
  4. final
  5. native
  6. interface
  7. static

Parameters:
modifier1 - - the modifier of the first Member
modifier2 - - the modifier of the second Member
Returns:
-1, 0 or 1 as per Comparator

compareByMethod

protected int compareByMethod(Method m1,
                              Method m2)
The compares the two Method values against each other in the following order :
  1. Method name
  2. Method return type
  3. Method parameter count
  4. Method parameter types


compareByField

protected int compareByField(Field f1,
                             Field f2)
The compares the two Field values against each other in the following order :
  1. Field name
  2. Field type


compareByConstructor

protected int compareByConstructor(Constructor c1,
                                   Constructor c2)
The compares the two Constructor values against each other in the following order :
  1. The Constructor parameter count
  2. The Constructor parameter type


EchoPoint API - 3.0.0b5
App Webcontainer