Skip to content

Conversation

@hinerm
Copy link
Member

@hinerm hinerm commented Jul 25, 2014

Refactors the conversion methods of ConversionUtils to an extensible, Handler-patterned ConvertService.

hinerm added 4 commits July 25, 2014 11:25
Adds a new HandlerService: ConversionService, operating on
ConversionHandler plugins.

The purpose of these handlers is to process a new class,
"ConversionRequest", which signifies the desire to cast or convert an
object of one type to another.

This will take the place of ConversionUtils, as it is an extensible
framework. ConversionHandler plugins can decide what types of conversion
they support and thus override the default behavior (the default plugin
supports primitive : object conversions and cases where the destination
object has a constructor that will accept the source, for example).

Closes #95
The ConversionUtils canConvert and convert methods will now all delegate
to a ConversionService, if available, or a DefaultConversionHandler if
no ConversionService has been set.

The ConversionUtils class will be retained, as it provides some API
which does not need generalization via a Service/plugin framework. All
delegating methods have been marked deprecated however, and consumers
should switch to ConversionService usage if possible.

Updated the AbstractConversionService so that ConversionServices set
themselves as the delegate service in CovnersionUtils on initialization
(only the highest priority will "stick").
All Contextual consumers of ConversionUtils are now updated to use the
ConversionService when appropriate.

Also updated the ConversionUtilsTest to make private test classes
public.
* package is now org.scijava.convert. Shouldn't have been a subpackage
  of *.util.
* ConversionHandler is now just a Converter, to imply action.
* ConversionService is now just ConvertService.
@ctrueden ctrueden changed the title ConverterService ConvertService Jul 25, 2014
ctrueden added a commit that referenced this pull request Jul 25, 2014
Refactors the conversion methods of ConversionUtils to an extensible,
Handler-patterned ConvertService.
@ctrueden ctrueden merged commit 973713f into master Jul 25, 2014
@ctrueden ctrueden deleted the create-conversion-service branch July 25, 2014 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants