Skip to content

io microsphere lang model util ExecutableElementComparator

github-actions[bot] edited this page Mar 21, 2026 · 1 revision

ExecutableElementComparator

Type: Class | Module: microsphere-lang-model | Package: io.microsphere.lang.model.util | Since: 1.0.0

Source: microsphere-lang-model/src/main/java/io/microsphere/lang/model/util/ExecutableElementComparator.java

Overview

The Comparator class for ExecutableElement, the comparison rule :

- Comparing to two `ExecutableElement#getSimpleName() element names` `String#compareTo(String) 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 `String#compareTo(String) lexicographically`

Example Usage

class Example {
    void methodA() {}
    void methodB() {}
    void methodB(String param1) {}
    void methodB(String param1, int param2) {}
}

When comparing methods:

- `methodA` vs `methodB`: the names are compared lexicographically.
- `methodB()` vs `methodB(String)`: the number of parameters is compared.
- `methodB(String)` vs `methodB(String, int)`: the parameter type names are compared lexicographically.

Declaration

public class ExecutableElementComparator implements Comparator<ExecutableElement>

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.1.10-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 8 ✅ Compatible
Java 11 ✅ Compatible
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

class Example {
    void methodA() {}
    void methodB() {}
    void methodB(String param1) {}
    void methodB(String param1, int param2) {}
}

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-lang-model</artifactId>
    <version>${microsphere-java.version}</version>
</dependency>

Tip: Use the BOM (microsphere-java-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.lang.model.util.ExecutableElementComparator;

API Reference

Public Methods

Method Description
compare

This documentation was auto-generated from the source code of microsphere-java.

Home

java-annotations

java-core

jdk-tools

lang-model

annotation-processor

java-test

Clone this wiki locally