org.eclipse.corona.tools.osgi
Class FilterHelpers

java.lang.Object
  extended by org.eclipse.corona.tools.osgi.FilterHelpers

public class FilterHelpers
extends java.lang.Object

Some helpers in creation of service filters.


Constructor Summary
FilterHelpers()
           
 
Method Summary
static java.lang.String createFilter(java.lang.String key, java.lang.Object value)
          Creates a simple key - value filter.
static java.lang.String escapeForFilter(java.lang.String str)
          Escapes reserved values from filter: [*\()].
static java.lang.StringBuffer escapeForFilter(java.lang.StringBuffer buf, java.lang.String str)
          Escapes reserved values from filter: [*\()].
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterHelpers

public FilterHelpers()
Method Detail

escapeForFilter

public static final java.lang.String escapeForFilter(java.lang.String str)
Escapes reserved values from filter: [*\()].

Parameters:
str - The filter value to escape. It is not a whole filter, but just a value!
Returns:
The escaped value.

escapeForFilter

public static final java.lang.StringBuffer escapeForFilter(java.lang.StringBuffer buf,
                                                           java.lang.String str)
Escapes reserved values from filter: [*\()].

Parameters:
buf - The buffer where the escaped string will be appended. If null a new buffer will be created.
str - The filter value to escape. It is not a whole filter, but just a value!
Returns:
The escaped value.

createFilter

public static final java.lang.String createFilter(java.lang.String key,
                                                  java.lang.Object value)
Creates a simple key - value filter. The value is only for exact match. All wildcards will be escaped.

Parameters:
key - The key for filter.
value - The value of the filter. All special chars and wildcards will be escaped.
Returns:
The OSGi filter in format "(key=value)"

Copyright 2006 IBM Corporation and others.
All Rights Reserved.