Class ExecutableElementComparator
- java.lang.Object
-
- io.microsphere.annotation.processor.util.ExecutableElementComparator
-
- All Implemented Interfaces:
java.util.Comparator<javax.lang.model.element.ExecutableElement>
public class ExecutableElementComparator extends java.lang.Object implements java.util.Comparator<javax.lang.model.element.ExecutableElement>
The Comparator class forExecutableElement
, the comparison rule :- Comparing to two
element names
lexicographically
. If equals, go to step 2 - Comparing to the count of two parameters. If equals, go to step 3
- Comparing to the type names of parameters
lexicographically
Example Usage
class Example { void methodA() {} void methodB() {} void methodB(String param1) {} void methodB(String param1, int param2) {} }
When comparing methods:
methodA
vsmethodB
: the names are compared lexicographically.methodB()
vsmethodB(String)
: the number of parameters is compared.methodB(String)
vsmethodB(String, int)
: the parameter type names are compared lexicographically.
- Since:
- 1.0.0
- Author:
- Mercy
-
-
Field Summary
Fields Modifier and Type Field Description static ExecutableElementComparator
INSTANCE
The singleton instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(javax.lang.model.element.ExecutableElement e1, javax.lang.model.element.ExecutableElement e2)
-
-
-
Field Detail
-
INSTANCE
public static final ExecutableElementComparator INSTANCE
The singleton instance
-
-