Package org.scijava.convert
Class AbstractConverter<I,O>
- java.lang.Object
-
- org.scijava.AbstractContextual
-
- org.scijava.plugin.AbstractRichPlugin
-
- org.scijava.plugin.AbstractTypedPlugin<D>
-
- org.scijava.plugin.AbstractHandlerPlugin<ConversionRequest>
-
- org.scijava.convert.AbstractConverter<I,O>
-
- All Implemented Interfaces:
Comparable<Prioritized>,Contextual,Converter<I,O>,Identifiable,Locatable,Logged,HandlerPlugin<ConversionRequest>,HasPluginInfo,RichPlugin,SciJavaPlugin,SingletonPlugin,TypedPlugin<ConversionRequest>,Prioritized,Typed<ConversionRequest>,Versioned
- Direct Known Subclasses:
AbstractDelegateConverter,ArrayToStringConverter,CastingConverter,DefaultConverter,FileListConverters.FileArrayToStringConverter,FileListConverters.FileToStringConverter,FileListConverters.StringToFileArrayConverter,FileListConverters.StringToFileConverter,FileToPathConverter,NullConverter,NumberToNumberConverter,PathToFileConverter,PrimitiveArrayUnwrapper,PrimitiveArrayWrapper,StringToArrayConverter,StringToNumberConverter
public abstract class AbstractConverter<I,O> extends AbstractHandlerPlugin<ConversionRequest> implements Converter<I,O>
Abstract superclass forConverterplugins. Performs appropriate dispatching ofConverter.canConvert(ConversionRequest)andConverter.convert(ConversionRequest)calls based on the actual state of the givenConversionRequest.- Author:
- Mark Hiner
-
-
Constructor Summary
Constructors Constructor Description AbstractConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidpopulateInputCandidates(Collection<Object> objects)Populates the given collection with objects which are known to exist, and which are usable as inputs for this converter.booleansupports(ConversionRequest request)Gets whether this object is compatible with the given data object.-
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
getInfo, getPriority, setInfo, setPriority, toString
-
Methods inherited from class org.scijava.AbstractContextual
context, getContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
-
Methods inherited from interface org.scijava.convert.Converter
canConvert, canConvert, canConvert, canConvert, canConvert, convert, convert, convert, getInputType, getOutputType, getType
-
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
-
Methods inherited from interface org.scijava.Locatable
getLocation
-
Methods inherited from interface org.scijava.Prioritized
compareTo, getPriority, setPriority
-
Methods inherited from interface org.scijava.plugin.RichPlugin
getIdentifier, log
-
Methods inherited from interface org.scijava.Versioned
getVersion
-
-
-
-
Method Detail
-
populateInputCandidates
public void populateInputCandidates(Collection<Object> objects)
Description copied from interface:ConverterPopulates the given collection with objects which are known to exist, and which are usable as inputs for this converter.That is: each such object added to the collection would return
trueif queried withconverter.canConvert(object), and hence would produce an output of typeConverter.getOutputType()if passed toconverter.convert(object).The means by which "known objects" are determined is implementation dependent, although the most typical use case is to query the
ObjectServicefor known objects of typeConverter.getInputType(), and return those. But other behaviors are possible, depending on the converter implementation.- Specified by:
populateInputCandidatesin interfaceConverter<I,O>- Parameters:
objects- an initialized collection into which appropriate objects will be inserted.
-
supports
public boolean supports(ConversionRequest request)
Description copied from interface:TypedGets whether this object is compatible with the given data object.By default, this method will return
trueiff the data is assignable to the associated type given byTyped.getType(). But individual implementations may have other requirements beyond class assignability.- Specified by:
supportsin interfaceConverter<I,O>- Specified by:
supportsin interfaceTyped<I>- Overrides:
supportsin classAbstractTypedPlugin<ConversionRequest>
-
-