@ProviderType
public interface Filter
Filter
s 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*)"
Modifier and Type | Method and Description |
---|---|
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. |
boolean match(ServiceReference<?> reference)
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.boolean match(java.util.Dictionary<java.lang.String,?> dictionary)
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.java.lang.String toString()
Filter
's filter string.
The filter string is normalized by removing whitespace which does not affect the meaning of the filter.
toString
in class java.lang.Object
Filter
's filter string.boolean equals(java.lang.Object obj)
Filter
to another Filter
.
This implementation returns the result of calling
this.toString().equals(obj.toString())
.
equals
in class java.lang.Object
obj
- The object to compare against this Filter
.Filter
object, then returns the
result of calling this.toString().equals(obj.toString())
;
false
otherwise.int hashCode()
Filter
.
This implementation returns the result of calling
this.toString().hashCode()
.
hashCode
in class java.lang.Object
Filter
.boolean matchCase(java.util.Dictionary<java.lang.String,?> dictionary)
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.boolean matches(java.util.Map<java.lang.String,?> map)
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.Copyright © OSGi Alliance (2000, 2020). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0