org.apache.felix.framework
Class FilterImpl

java.lang.Object
  extended by org.apache.felix.framework.FilterImpl
All Implemented Interfaces:
Filter

public class FilterImpl
extends Object
implements Filter

This class implements an RFC 1960-based filter. The syntax of the filter string is the string representation of LDAP search filters as defined in RFC 1960. These filters are used to search for services and to track services using ServiceTracker objects.


Constructor Summary
FilterImpl(Logger logger, String expr)
          Construct a filter for a given filter expression string.
FilterImpl(String expr)
           
 
Method Summary
 boolean equals(Object o)
          Compares the Filter object to another.
 int hashCode()
          Returns the hash code for the Filter object.
 boolean match(Dictionary dict)
          Filter using a Dictionary object.
 boolean match(ServiceReference ref)
          Filter using a service's properties.
 boolean matchCase(Dictionary dict)
           
 String toString()
          Returns the Filter object's filter string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilterImpl

public FilterImpl(String expr)
           throws InvalidSyntaxException
Throws:
InvalidSyntaxException

FilterImpl

public FilterImpl(Logger logger,
                  String expr)
           throws InvalidSyntaxException
Construct a filter for a given filter expression string.

Parameters:
expr - the filter expression string for the filter.
Throws:
InvalidSyntaxException
Method Detail

equals

public boolean equals(Object o)
Compares the Filter object to another.

Specified by:
equals in interface Filter
Overrides:
equals in class Object
Parameters:
o - the object to compare this Filter against.
Returns:
If the other object is a Filter object, it returns this.toString().equals(obj.toString()); false otherwise.

hashCode

public int hashCode()
Returns the hash code for the Filter object.

Specified by:
hashCode in interface Filter
Overrides:
hashCode in class Object
Returns:
The value this.toString().hashCode().

match

public boolean match(Dictionary dict)
              throws IllegalArgumentException
Filter using a Dictionary object. The Filter is executed using the Dictionary object's keys and values.

Specified by:
match in interface Filter
Parameters:
dict - the Dictionary object whose keys and values are used to determine a match.
Returns:
true if the Dictionary object's keys and values match this filter; false otherwise.
Throws:
IllegalArgumentException - if the dictionary contains case variants of the same key name.

match

public boolean match(ServiceReference ref)
Filter using a service's properties. The Filter is executed using the properties of the referenced service.

Specified by:
match in interface Filter
Parameters:
ref - A reference to the service whose properties are used to determine a match.
Returns:
true if the service's properties match this filter; false otherwise.

matchCase

public boolean matchCase(Dictionary dict)
Specified by:
matchCase in interface Filter

toString

public String toString()
Returns the Filter object's filter string.

Specified by:
toString in interface Filter
Overrides:
toString in class Object
Returns:
Filter string.


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.