接口 Filter

  • 所有已知实现类:
    FilterImpl

    @ProviderType
    public interface Filter
    An RFC 1960-based Filter.

    Filters can be created by calling BundleContext.createFilter(String) or FrameworkUtil.createFilter(String) with a filter string.

    A Filter can be used numerous times to determine if the match argument matches the filter string that was used to create the Filter.

    Some examples of LDAP filters are:

      "(cn=Babs Jensen)"
      "(!(cn=Tim Howes))"
      "(&(" + Constants.OBJECTCLASS + "=Person)(|(sn=Jensen)(cn=Babs J*)))"
      "(o=univ*of*mich*)"
     
    从以下版本开始:
    1.1
    作者:
    $Id: 58cd4db16892b20e44be1288ccac929a5a26c53a $
    另请参阅:
    "Core Specification, Filters, for a description of the filter string syntax."
    • 方法概要

      所有方法 实例方法 抽象方法 
      修饰符和类型 方法 说明
      boolean equals​(java.lang.Object obj)
      Compares this Filter to another Filter.
      int hashCode()
      Returns the hashCode for this Filter.
      boolean match​(java.util.Dictionary<java.lang.String,​?> dictionary)
      Filter using a Dictionary with case insensitive key lookup.
      boolean match​(ServiceReference<?> reference)
      Filter using a service's properties.
      boolean matchCase​(java.util.Dictionary<java.lang.String,​?> dictionary)
      Filter using a Dictionary.
      boolean matches​(java.util.Map<java.lang.String,​?> map)
      Filter using a Map.
      java.lang.String toString()
      Returns this Filter's filter string.
    • 方法详细资料

      • match

        boolean match​(ServiceReference<?> reference)
        Filter using a service's properties.

        This Filter is executed using the keys and values of the referenced service's properties. The keys are looked up in a case insensitive manner.

        参数:
        reference - The reference to the service whose properties are used in the match.
        返回:
        true if the service's properties match this Filter; false otherwise.
      • match

        boolean match​(java.util.Dictionary<java.lang.String,​?> dictionary)
        Filter using a Dictionary with case insensitive key lookup. This Filter is executed using the specified Dictionary's keys and values. The keys are looked up in a case insensitive manner.
        参数:
        dictionary - The Dictionary whose key/value pairs are used in the match.
        返回:
        true if the Dictionary's values match this filter; false otherwise.
        抛出:
        java.lang.IllegalArgumentException - If dictionary contains case variants of the same key name.
      • toString

        java.lang.String toString()
        Returns this Filter's filter string.

        The filter string is normalized by removing whitespace which does not affect the meaning of the filter.

        覆盖:
        toString 在类中 java.lang.Object
        返回:
        This Filter's filter string.
      • equals

        boolean equals​(java.lang.Object obj)
        Compares this Filter to another Filter.

        This implementation returns the result of calling this.toString().equals(obj.toString()).

        覆盖:
        equals 在类中 java.lang.Object
        参数:
        obj - The object to compare against this Filter.
        返回:
        If the other object is a Filter object, then returns the result of calling this.toString().equals(obj.toString()); false otherwise.
      • hashCode

        int hashCode()
        Returns the hashCode for this Filter.

        This implementation returns the result of calling this.toString().hashCode().

        覆盖:
        hashCode 在类中 java.lang.Object
        返回:
        The hashCode of this Filter.
      • matchCase

        boolean matchCase​(java.util.Dictionary<java.lang.String,​?> dictionary)
        Filter using a Dictionary. This Filter is executed using the specified Dictionary's keys and values. The keys are looked up in a normal manner respecting case.
        参数:
        dictionary - The Dictionary whose key/value pairs are used in the match.
        返回:
        true if the Dictionary's values match this filter; false otherwise.
        从以下版本开始:
        1.3
      • matches

        boolean matches​(java.util.Map<java.lang.String,​?> map)
        Filter using a Map. This Filter is executed using the specified Map's keys and values. The keys are looked up in a normal manner respecting case.
        参数:
        map - The Map whose key/value pairs are used in the match. Maps with null key or values are not supported. A null value is considered not present to the filter.
        返回:
        true if the Map's values match this filter; false otherwise.
        从以下版本开始:
        1.6