Class FilterComparator

java.lang.Object
com.unboundid.ldap.sdk.unboundidds.examples.FilterComparator
All Implemented Interfaces:
Serializable, Comparator<Filter>

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:
  • Method Details

    • 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 interface Comparator<Filter>
      Parameters:
      f1 - The first filter for which to make the determination. It must not be null
      f2 - The second filter for which to make the determination. It must not be null
      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 class Object
      Returns:
      A hash code for this filter comparator.
    • equals

      public boolean equals(@Nullable Object o)
      Indicates whether the provided object is equal to this filter comparator.
      Specified by:
      equals in interface Comparator<Filter>
      Overrides:
      equals in class Object
      Parameters:
      o - The object for which to make the determination.
      Returns:
      true if the provided object is equal to this filter comparator, or false if not.