DT
- Base data typePT
- Plugin typepublic interface WrapperService<DT,PT extends WrapperPlugin<DT>> extends TypedService<DT,PT>
WrapperPlugin
s of a particular type. A
WrapperPlugin
is a stateful TypedPlugin
which wraps a
particular object of its associated data type. For any given data object, the
service is capable of wrapping it with the most appropriate wrapper by
sequentially querying each WrapperPlugin
on its list for
compatibility.
Note that like PTService
, SingletonService
and
TypedService
, WrapperService
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.
WrapperPlugin
,
PTService
Modifier and Type | Method and Description |
---|---|
default <D extends DT> |
create(D data)
Creates a new plugin instance wrapping the given associated data object.
|
default void |
initialize()
Performs any needed initialization when the service is first loaded.
|
default boolean |
supports(DT data)
Gets whether this object is compatible with the given data object.
|
find
create, getPlugins, getPluginService, getPluginType, pluginService
registerEventHandlers
getIdentifier, log
context, getContext, setContext
compareTo, getPriority, setPriority
getInfo, setInfo
getLocation
getVersion
dispose
default <D extends DT> PT create(D data)
default void initialize()
Service
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.
initialize
in interface Initializable
initialize
in interface Service
default boolean supports(DT data)
Typed
By default, this method will return true
iff the data is assignable
to the associated type given by Typed.getType()
. But individual
implementations may have other requirements beyond class assignability.
Copyright © 2015–2022 SciJava. All rights reserved.