Package org.osgi.framework
Interface Filter
-
public interface Filter
An RFC 1960-based Filter.Filter
s can be created by callingBundleContext.createFilter(java.lang.String)
orFrameworkUtil.createFilter(java.lang.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 theFilter
.Some examples of LDAP filters are:
"(cn=Babs Jensen)" "(!(cn=Tim Howes))" "(&(" + Constants.OBJECTCLASS + "=Person)(|(sn=Jensen)(cn=Babs J*)))" "(o=univ*of*mich*)"
- Since:
- 1.1
- Version:
- $Revision: 6860 $
- See Also:
- "Core Specification, section 5.5, for a description of the filter string syntax."
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Compares thisFilter
to anotherFilter
.int
hashCode()
Returns the hashCode for thisFilter
.boolean
match(java.util.Dictionary dictionary)
Filter using aDictionary
.boolean
match(ServiceReference reference)
Filter using a service's properties.boolean
matchCase(java.util.Dictionary dictionary)
Filter with case sensitivity using aDictionary
.java.lang.String
toString()
Returns thisFilter
's filter string.
-
-
-
Method Detail
-
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 case insensitively matched with thisFilter
.- Parameters:
reference
- The reference to the service whose properties are used in the match.- Returns:
true
if the service's properties match thisFilter
;false
otherwise.
-
match
boolean match(java.util.Dictionary dictionary)
Filter using aDictionary
. ThisFilter
is executed using the specifiedDictionary
's keys and values. The keys are case insensitively matched with thisFilter
.- Parameters:
dictionary
- TheDictionary
whose keys are used in the match.- Returns:
true
if theDictionary
's keys and values match this filter;false
otherwise.- Throws:
java.lang.IllegalArgumentException
- Ifdictionary
contains case variants of the same key name.
-
toString
java.lang.String toString()
Returns thisFilter
's filter string.The filter string is normalized by removing whitespace which does not affect the meaning of the filter.
- Overrides:
toString
in classjava.lang.Object
- Returns:
- This
Filter
's filter string.
-
equals
boolean equals(java.lang.Object obj)
Compares thisFilter
to anotherFilter
.This method returns the result of calling
this.toString().equals(obj.toString())
.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- The object to compare against thisFilter
.- Returns:
- If the other object is a
Filter
object, then returns the result of callingthis.toString().equals(obj.toString())
;false
otherwise.
-
hashCode
int hashCode()
Returns the hashCode for thisFilter
.This method returns the result of calling
this.toString().hashCode()
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- The hashCode of this
Filter
.
-
matchCase
boolean matchCase(java.util.Dictionary dictionary)
Filter with case sensitivity using aDictionary
. ThisFilter
is executed using the specifiedDictionary
's keys and values. The keys are case sensitively matched with thisFilter
.- Parameters:
dictionary
- TheDictionary
whose keys are used in the match.- Returns:
true
if theDictionary
's keys and values match this filter;false
otherwise.- Since:
- 1.3
-
-