All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aQute.bnd.service.Registry Maven / Gradle / Ivy

The newest version!
package aQute.bnd.service;

import java.util.List;
import java.util.stream.Collectors;

import aQute.bnd.service.tags.Tagged;

/**
 * A registry for objects.
 */
public interface Registry {

	/**
	 * @param 
	 * @param c
	 * @return all plugins matching the given class
	 */
	 List getPlugins(Class c);

	/**
	 * @param 
	 * @param c
	 * @param tags
	 * @return All plugins that have a tag that matches at least one of the
     *         given tags or have no tags.
	 */
	default  List getPlugins(Class c, String... tags) {

		if (tags.length == 0) {
			return getPlugins(c);
		}

		return getPlugins(c).stream()
			.filter(plugin -> (plugin instanceof Tagged taggedPlugin) ? taggedPlugin.getTags()
				.includesAny(tags) : true)
			.collect(Collectors.toList());
	}

	 T getPlugin(Class c);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy