/*
 * #%L
 * SciJava Common shared library for SciJava software.
 * %%
 * Copyright (C) 2009 - 2016 Board of Regents of the University of
 * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck
 * Institute of Molecular Cell Biology and Genetics.
 * %%
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 * #L%
 */

package org.scijava.plugin;

import org.scijava.Typed;

/**
 * A service for managing a particular sort of {@link TypedPlugin}.
 * <p>
 * Note that like {@link PTService}, {@link SingletonService} and
 * {@link WrapperService}, {@code TypedService} is not a service interface
 * defining API for a specific concrete service implementation, but rather a
 * more general layer in a type hierarchy intended to ease creation of services
 * that fit its pattern.
 * </p>
 * 
 * @author Curtis Rueden
 * @param <DT> Base data type of the {@link TypedPlugin}s.
 * @param <PT> Plugin type of the {@link TypedPlugin}s.
 * @see TypedPlugin
 * @see PTService
 */
public interface TypedService<DT, PT extends TypedPlugin<DT>> extends
	PTService<PT>, Typed<DT>
{
	// NB: Marker interface.
}

@@ -2334,32 +2334,648 @@
 %3E%0A%7B%0A
+%0A
 %09/
-/ NB: Marker interface.
+**%0A%09 * Gets a new instance of the highest priority plugin managed by this service%0A%09 * which supports the given data object according to the %7B@link Typed%7D%0A%09 * interface.%0A%09 * %3Cp%3E%0A%09 * Note that this newly created plugin instance will %3Cem%3Enot%3C/em%3E actually be%0A%09 * injected with the given data object!%0A%09 * %3C/p%3E%0A%09 * %0A%09 * @see HandlerService#getHandler(Object)%0A%09 * @see WrapperService#create(Object)%0A%09 */%0A%09default PT find(final DT data) %7B%0A%09%09for (final PluginInfo%3CPT%3E plugin : getPlugins()) %7B%0A%09%09%09final PT instance = pluginService().createInstance(plugin);%0A%09%09%09if (instance != null && instance.supports(data)) return instance;%0A%09%09%7D%0A%09%09return null;%0A%09%7D
 %0A%7D%0A

add a way to find the best plugin