public abstract class OsgiFilterUtils extends Object
Constructor and Description |
---|
OsgiFilterUtils() |
Modifier and Type | Method and Description |
---|---|
static org.osgi.framework.Filter |
createFilter(String filter)
Creates an OSGi
Filter from the given String. |
static String |
getFilter(org.osgi.framework.ServiceReference reference)
Creates a filter (as String) that matches the properties (expect the service id) of service reference.
|
static boolean |
isValidFilter(String filter)
Validates the given String as a OSGi filter.
|
static String |
unifyFilter(Class<?>[] classes,
String filter)
Adds the given classes to the given filter.
|
static String |
unifyFilter(Class<?> clazz,
String filter)
Adds the given class to the given filter.
|
static String |
unifyFilter(String[] classes,
String filter)
Adds the given classes as an 'and'(&)
Constants.OBJECTCLASS constraint to the given filter. |
static String |
unifyFilter(String clazz,
String filter)
Adds the given class as an 'and'(&)
Constants.OBJECTCLASS constraint to the given filter. |
static String |
unifyFilter(String key,
String[] items,
String filter)
Concatenates the given strings with an 'and'(&) constraint under the given key to the given filter.
|
public static String unifyFilter(String clazz, String filter)
Constants.OBJECTCLASS
constraint to the given filter. At least
one parameter must be valid (non-null
).clazz
- class name (can be null
)filter
- valid OSGi filter (can be null
)Constants.OBJECTCLASS
constraint and the given filterpublic static String unifyFilter(Class<?> clazz, String filter)
null
).clazz
- fully qualified class name (can be null
)filter
- valid OSGi filter (can be null
)unifyFilter(String, String)
public static String unifyFilter(Class<?>[] classes, String filter)
null
).classes
- array of fully qualified class names (can be null
/empty)filter
- valid OSGi filter (can be null
)unifyFilter(String[], String)
public static String unifyFilter(String[] classes, String filter)
Constants.OBJECTCLASS
constraint to the given filter. At least
one parameter must be valid (non-null
).classes
- array of fully qualified class names (can be null
/empty)filter
- valid OSGi filter (can be null
)public static String unifyFilter(String key, String[] items, String filter)
null
).key
- the key under which the items are being concatenated (required)items
- an array of strings concatenated to the existing filterfilter
- valid OSGi filter (can be null
)public static boolean isValidFilter(String filter)
filter
- OSGi filterpublic static org.osgi.framework.Filter createFilter(String filter)
Filter
from the given String. Translates the InvalidSyntaxException
checked
exception into an unchecked IllegalArgumentException
.filter
- OSGi filter given as a StringFilter
)public static String getFilter(org.osgi.framework.ServiceReference reference)
reference
- Copyright © 2006–2015. All rights reserved.