code: private static Filter createFilter(final BundleContext bundleContext, final Class<?>... classes) {
  		final StringBuilder filter = new StringBuilder();
  		if (classes != null) {
  			if (classes.length > 1) {
  				filter.append("(|");
  			}
  			for (Class<?> clazz : classes) {
  				filter.append("(").append(Constants.OBJECTCLASS).append("=").append(clazz.getName()).append(")");
  			}
  			if (classes.length > 1) {
  				filter.append(")");
  			}
  		}
  		try {
  			return bundleContext.createFilter(filter.toString());
  		} catch (InvalidSyntaxException e) {
  			throw new IllegalArgumentException("Unexpected InvalidSyntaxException: " + e.getMessage());
  		}
  	}
docs: Creates an OSGi filter for the classes.
  
  @param bundleContext
  a bundle context
  @param classes
  array of tracked classes
  @return osgi filter