org.scijava.convert
Class AbstractConverter
java.lang.Object
org.scijava.AbstractContextual
org.scijava.plugin.AbstractRichPlugin
org.scijava.plugin.AbstractTypedPlugin<D>
org.scijava.plugin.AbstractHandlerPlugin<ConversionRequest>
org.scijava.convert.AbstractConverter
- All Implemented Interfaces:
- Comparable<Prioritized>, Contextual, Converter, HandlerPlugin<ConversionRequest>, HasPluginInfo, RichPlugin, SciJavaPlugin, SingletonPlugin, TypedPlugin<ConversionRequest>, Prioritized, Typed<ConversionRequest>
- Direct Known Subclasses:
- DefaultConverter
public abstract class AbstractConverter
- extends AbstractHandlerPlugin<ConversionRequest>
- implements Converter
Abstract superclass for Converter
plugins. Performs
appropriate dispatching of canConvert(ConversionRequest)
and
convert(ConversionRequest)
calls based on the actual state of the
given ConversionRequest
.
Note that the supports(ConversionRequest)
method is overridden as
well, to delegate to the appropriate canConvert(org.scijava.convert.ConversionRequest)
.
- Author:
- Mark Hiner
AbstractConverter
public AbstractConverter()
canConvert
public boolean canConvert(ConversionRequest request)
- Description copied from interface:
Converter
- Checks whether a given can be
processed, by converting the desired
ConversionRequest.sourceClass()
to its
ConversionRequest.destClass()
or
ConversionRequest.destType()
.
- Specified by:
canConvert
in interface Converter
- See Also:
Converter.convert(ConversionRequest)
convert
public Object convert(ConversionRequest request)
- Description copied from interface:
Converter
- Converts the given
ConversionRequest.sourceObject()
to the
specified ConversionRequest.destClass()
or
ConversionRequest.destType()
.
- Specified by:
convert
in interface Converter
- Parameters:
request
- ConversionRequest
to process.
- Returns:
- The conversion output
- See Also:
Converter.convert(Object, Class)
,
Converter.convert(Object, Type)
supports
public boolean supports(ConversionRequest request)
- Description copied from interface:
Typed
- Gets whether this object is compatible with the given data object.
Typically, this will be the case when data.getClass()
is assignable
to the type associated with the object (i.e., the one returned by
Typed.getType()
). But individual implementations may have other
requirements beyond class assignability.
- Specified by:
supports
in interface Typed<ConversionRequest>
- Overrides:
supports
in class AbstractTypedPlugin<ConversionRequest>
getType
public Class<ConversionRequest> getType()
- Description copied from interface:
Typed
- Gets the type associated with the object.
- Specified by:
getType
in interface Typed<ConversionRequest>
Copyright © 2009–2014 SciJava. All rights reserved.