public final class ConfigSourceComparator extends Object implements Comparator<ConfigSource>
Comparator of ConfigSources that considers only
their ordinals and
names in accordance with the
minimal requirements of the MicroProfile Config specification as
spelled out (only) in the ConfigSource API documentation.
This Comparator implementation is, and must be,
inconsistent with equals(),
as implied by the same specification.
Note that the requirement to use a ConfigSource's
name as a secondary sorting key
is defined only in the javadocs of the ConfigSource.getOrdinal() method.
Note further that there are no guidelines or requirements about
what format a ConfigSource's name must take, so in effect the ordering
of two ConfigSources that have a common ordinal is undefined.
| Modifier and Type | Field and Description |
|---|---|
static ConfigSourceComparator |
INSTANCE
The sole instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(ConfigSource firstConfigSource,
ConfigSource secondConfigSource)
Compares two
ConfigSources, returning -1 if the
first has an ordinal
greater than that of the second and 1 if the second has
an ordinal greater than
that of the first, and then the result of invoking String.compareTo(String) on the return values of the ConfigSources' respective ConfigSource.getName()
methods. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongpublic static final ConfigSourceComparator INSTANCE
public final int compare(ConfigSource firstConfigSource, ConfigSource secondConfigSource)
ConfigSources, returning -1 if the
first has an ordinal
greater than that of the second and 1 if the second has
an ordinal greater than
that of the first, and then the result of invoking String.compareTo(String) on the return values of the ConfigSources' respective ConfigSource.getName()
methods.
This method may return 0 when both ConfigSources are not otherwise semantically equal.
compare in interface Comparator<ConfigSource>firstConfigSource - the first of two ConfigSources;
may be nullsecondConfigSource - the second of two ConfigSources; may be null-1 if the first ConfigSource has an
ordinal greater than that
of the second, 1 if the second ConfigSource has
an ordinal greater than
that of the first, and the result of invoking String.compareTo(String) on the return values of the ConfigSources' respective ConfigSource.getName() methods
otherwiseConfigSource,
ConfigSource.getName(),
ConfigSource.getOrdinal()Copyright © 2019–2021, microBean™. All rights reserved.