Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package org.osgi.framework;
 
 import java.util.Map;

An RFC 1960-based Filter.

Filters can be created by calling BundleContext.createFilter(java.lang.String) or FrameworkUtil.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 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*)"
 

Version:
$Id: 743270de7c45cf30e7904e13b1bb38ce08042467 $
Since:
1.1
See also:
"Core Specification, Filters, for a description of the filter string syntax."
ThreadSafe:
Noimplement:
 
 public interface Filter {
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.

Parameters:
reference The reference to the service whose properties are used in the match.
Returns:
true if the service's properties match this Filter; false otherwise.
 
 	boolean match(ServiceReference< ? > reference);

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.

Parameters:
dictionary The Dictionary whose key/value pairs are used in the match.
Returns:
true if the Dictionary's values match this filter; false otherwise.
Throws:
java.lang.IllegalArgumentException If dictionary contains case variants of the same key name.
 
 	boolean match(Dictionary<String, ? > dictionary);

Returns this Filter's filter string.

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

Returns:
This Filter's filter string.
 
Compares this Filter to another Filter.

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

Parameters:
obj The object to compare against this Filter.
Returns:
If the other object is a Filter object, then returns the result of calling this.toString().equals(obj.toString()); false otherwise.
 
 	boolean equals(Object obj);

Returns the hashCode for this Filter.

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

Returns:
The hashCode of this Filter.
	int hashCode();

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.

Parameters:
dictionary The Dictionary whose key/value pairs are used in the match.
Returns:
true if the Dictionary's values match this filter; false otherwise.
Since:
1.3
	boolean matchCase(Dictionary<String, ? > dictionary);

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.

Parameters:
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.
Returns:
true if the Map's values match this filter; false otherwise.
Since:
1.6
	boolean matches(Map<String, ? > map);
New to GrepCode? Check out our FAQ X