public abstract class AbstractConverter<I,O> extends AbstractHandlerPlugin<ConversionRequest> implements Converter<I,O>
Converter
plugins. Performs appropriate
dispatching of Converter.canConvert(ConversionRequest)
and
Converter.convert(ConversionRequest)
calls based on the actual state of the
given ConversionRequest
.Constructor and Description |
---|
AbstractConverter() |
Modifier and Type | Method and Description |
---|---|
void |
populateInputCandidates(Collection<Object> objects)
Populates the given collection with objects which are known to exist, and
which are usable as inputs for this converter.
|
boolean |
supports(ConversionRequest request)
Gets whether this object is compatible with the given data object.
|
getInfo, getPriority, setInfo, setPriority, toString
context, getContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
canConvert, canConvert, canConvert, canConvert, canConvert, convert, convert, convert, getInputType, getOutputType, getType
getIdentifier, log
context, getContext, setContext
compareTo, getPriority, setPriority
getInfo, setInfo
getLocation
getVersion
public void populateInputCandidates(Collection<Object> objects)
Converter
That is: each such object added to the collection would return true
if queried with converter.canConvert(object)
, and hence would
produce an output of type Converter.getOutputType()
if passed to
converter.convert(object)
.
The means by which "known objects" are determined is implementation
dependent, although the most typical use case is to query the
ObjectService
for known objects of type Converter.getInputType()
,
and return those. But other behaviors are possible, depending on the
converter implementation.
populateInputCandidates
in interface Converter<I,O>
objects
- an initialized collection into which appropriate objects
will be inserted.public boolean supports(ConversionRequest request)
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.
supports
in interface Converter<I,O>
supports
in interface Typed<ConversionRequest>
supports
in class AbstractTypedPlugin<ConversionRequest>
Copyright © 2009–2023 SciJava. All rights reserved.