Class FilterComparator
- java.lang.Object
-
- com.unboundid.ldap.sdk.unboundidds.examples.FilterComparator
-
- All Implemented Interfaces:
java.io.Serializable
,java.util.Comparator<Filter>
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class FilterComparator extends java.lang.Object implements java.util.Comparator<Filter>, java.io.Serializable
This class provides a comparator that may be used to define a relative order for search filters. The filter order will be based first on the filter type (in the following order: AND, OR, NOT, equality, substring, greater-or-equal, less-or-equal, presence, approximate match, extensible match), then based on the attribute name, and then by the assertion value. For AND and OR filters, with all other things equal, a filter with fewer components will be ordered before one with more components. For a substring filter with all other things equal, then a filter missing a substring element will be ordered before one with that element, and one with fewer subAny elements will be ordered before one with more subAny elements. For an extensible match filter with all other things being equal, a filter without an element will be ordered before one with that element.
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundidds
package structure, are only supported for use against Ping Identity, UnboundID, and Nokia/Alcatel-Lucent 8661 server products. These classes provide support for proprietary functionality or for external specifications that are not considered stable or mature enough to be guaranteed to work in an interoperable way with other types of LDAP servers.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(Filter f1, Filter f2)
Determines a relative order for the provided filter objects.boolean
equals(java.lang.Object o)
Indicates whether the provided object is equal to this filter comparator.static FilterComparator
getInstance()
Retrieves the singleton instance of this filter comparator.int
hashCode()
Retrieves a hash code for this filter comparator.
-
-
-
Method Detail
-
getInstance
@NotNull public static FilterComparator getInstance()
Retrieves the singleton instance of this filter comparator.- Returns:
- The singleton instance of this filter comparator.
-
compare
public int compare(@NotNull Filter f1, @NotNull Filter f2)
Determines a relative order for the provided filter objects.- Specified by:
compare
in interfacejava.util.Comparator<Filter>
- Parameters:
f1
- The first filter for which to make the determination. It must not benull
f2
- The second filter for which to make the determination. It must not benull
- Returns:
- A negative value if the first filter should be ordered before the second, a positive value if the first filter should be ordered after the second, or zero if there is no difference in their relative orders.
-
hashCode
public int hashCode()
Retrieves a hash code for this filter comparator.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code for this filter comparator.
-
equals
public boolean equals(@Nullable java.lang.Object o)
Indicates whether the provided object is equal to this filter comparator.- Specified by:
equals
in interfacejava.util.Comparator<Filter>
- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- The object for which to make the determination.- Returns:
true
if the provided object is equal to this filter comparator, orfalse
if not.
-
-