org.scijava.plugin
Class AbstractSingletonService<PT extends SingletonPlugin>
java.lang.Object
org.scijava.AbstractContextual
org.scijava.plugin.AbstractRichPlugin
org.scijava.service.AbstractService
org.scijava.plugin.AbstractPTService<PT>
org.scijava.plugin.AbstractSingletonService<PT>
- Type Parameters:
PT
- Plugin type of the SingletonPlugin
s being managed.
- All Implemented Interfaces:
- Comparable<Prioritized>, Contextual, Disposable, HasPluginInfo, PTService<PT>, RichPlugin, SciJavaPlugin, SingletonService<PT>, Prioritized, Service
- Direct Known Subclasses:
- AbstractHandlerService, DefaultAppService, DefaultOptionsService, DefaultPlatformService, DefaultScriptService, DefaultToolService
public abstract class AbstractSingletonService<PT extends SingletonPlugin>
- extends AbstractPTService<PT>
- implements SingletonService<PT>
Abstract base class for SingletonService
s.
- Author:
- Curtis Rueden
Method Summary |
|
create(Class<P> pluginClass)
Creates an instance of the given plugin class. |
protected List<? extends PT> |
filterInstances(List<PT> list)
Allows subclasses to exclude instances. |
|
getInstance(Class<P> pluginClass)
Gets the singleton plugin instance of the given class. |
List<PT> |
getInstances()
Gets the list of plugin instances. |
void |
initialize()
Performs any needed initialization when the service is first loaded. |
AbstractSingletonService
public AbstractSingletonService()
getInstances
public List<PT> getInstances()
- Description copied from interface:
SingletonService
- Gets the list of plugin instances. There will be one singleton instance for
each available plugin.
- Specified by:
getInstances
in interface SingletonService<PT extends SingletonPlugin>
getInstance
public <P extends PT> P getInstance(Class<P> pluginClass)
- Description copied from interface:
SingletonService
- Gets the singleton plugin instance of the given class.
- Specified by:
getInstance
in interface SingletonService<PT extends SingletonPlugin>
create
public <P extends PT> P create(Class<P> pluginClass)
- Description copied from interface:
PTService
- Creates an instance of the given plugin class.
- Specified by:
create
in interface PTService<PT extends SingletonPlugin>
- Overrides:
create
in class AbstractPTService<PT extends SingletonPlugin>
initialize
public void initialize()
- Description copied from interface:
Service
- Performs any needed initialization when the service is first loaded.
NB: This method is not intended to be called directly. It is called by
the service framework itself (specifically by the ServiceHelper
)
when initializing the service. It should not be called a second time.
- Specified by:
initialize
in interface Service
- Overrides:
initialize
in class AbstractService
filterInstances
protected List<? extends PT> filterInstances(List<PT> list)
- Allows subclasses to exclude instances.
- Parameters:
list
- the initial list of instances
- Returns:
- the filtered list of instances
Copyright © 2009–2015 SciJava. All rights reserved.