|
37 | 37 | import org.scijava.convert.ConvertService;
|
38 | 38 | import org.scijava.convert.Converter;
|
39 | 39 | import org.scijava.convert.DefaultConverter;
|
40 |
| -import org.scijava.prefs.DefaultPrefService; |
41 | 40 |
|
42 | 41 | /**
|
43 | 42 | * Useful methods for converting and casting between classes and types.
|
|
50 | 49 | */
|
51 | 50 | public class ConversionUtils {
|
52 | 51 |
|
53 |
| - private static ConvertService conversionService; |
| 52 | + private static ConvertService convertService; |
54 | 53 |
|
55 |
| - private static Converter conversionHandlerNoContext; |
| 54 | + private static Converter converterNoContext; |
56 | 55 |
|
57 | 56 | private static double servicePriority = 0.0;
|
58 | 57 |
|
@@ -172,18 +171,18 @@ public static <T> T getNullValue(final Class<T> type) {
|
172 | 171 | return result;
|
173 | 172 | }
|
174 | 173 |
|
175 |
| - // -- PrefService setter -- |
| 174 | + // -- ConvertService setter -- |
176 | 175 |
|
177 | 176 | /**
|
178 |
| - * Sets the {@link ConvertService} |
| 177 | + * Sets the {@link ConvertService} to use for handling conversion requests. |
179 | 178 | */
|
180 |
| - public static void setDelegateService(final ConvertService conversionService, |
| 179 | + public static void setDelegateService(final ConvertService convertService, |
181 | 180 | final double priority)
|
182 | 181 | {
|
183 |
| - if (ConversionUtils.conversionService == null || |
| 182 | + if (ConversionUtils.convertService == null || |
184 | 183 | Double.compare(priority, servicePriority) > 0)
|
185 | 184 | {
|
186 |
| - ConversionUtils.conversionService = conversionService; |
| 185 | + ConversionUtils.convertService = convertService; |
187 | 186 | servicePriority = priority;
|
188 | 187 | }
|
189 | 188 | }
|
@@ -265,18 +264,17 @@ public static Class<?> getComponentClass(final Type type) {
|
265 | 264 | //-- Helper methods --
|
266 | 265 |
|
267 | 266 | /**
|
268 |
| - * Gets the delegate {@link ConvertService} to use for preference operations. |
269 |
| - * If this service has not been explicitly set, then a |
270 |
| - * {@link DefaultPrefService} will be used. |
| 267 | + * Gets the {@link Converter} to use for the given conversion request. If the |
| 268 | + * delegate {@link ConvertService} has not been explicitly set, then a |
| 269 | + * {@link DefaultConverter} will be used. |
271 | 270 | *
|
272 |
| - * @return The current {@link ConvertService} to use for delegation. |
| 271 | + * @return The {@link Converter} to use for handling the given request. |
273 | 272 | */
|
274 | 273 | private static Converter handler(final ConversionRequest data) {
|
275 |
| - if (conversionService != null) return conversionService.getHandler(data); |
| 274 | + if (convertService != null) return convertService.getHandler(data); |
276 | 275 |
|
277 |
| - if (conversionHandlerNoContext == null) conversionHandlerNoContext = |
278 |
| - new DefaultConverter(); |
| 276 | + if (converterNoContext == null) converterNoContext = new DefaultConverter(); |
279 | 277 |
|
280 |
| - return conversionHandlerNoContext; |
| 278 | + return converterNoContext; |
281 | 279 | }
|
282 | 280 | }
|
0 commit comments