public class DefaultConverter extends AbstractConverter<Object,Object>
Converter implementation. Provides useful conversion
functionality for many common conversion cases.
Supported conversions include:
| Constructor and Description |
|---|
DefaultConverter() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canConvert(Class<?> src,
Class<?> dest)
Deprecated.
|
boolean |
canConvert(Class<?> src,
Type dest)
Deprecated.
|
<T> T |
convert(Object src,
Class<T> dest)
Converts the given object to an object of the specified type.
|
Object |
convert(Object src,
Type dest)
As
Converter.convert(Object, Class) but capable of creating and populating
multi-element objects (Collections and array types). |
Class<Object> |
getInputType() |
Class<Object> |
getOutputType() |
canConvert, canConvert, canConvert, convert, getType, populateInputCandidates, supportsgetInfo, getPriority, setInfo, setPriority, toStringcontext, getContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetIdentifier, logcontext, getContext, setContextcompareTo, getPriority, setPrioritygetInfo, setInfogetLocationgetVersionpublic Object convert(Object src, Type dest)
ConverterConverter.convert(Object, Class) but capable of creating and populating
multi-element objects (Collections and array types). If a single
element type is provided, it will be converted the same as
Converter.convert(Object, Class). If a multi-element type is detected, then
the value parameter will be interpreted as potential collection of values.
An appropriate container will be created, and the full set of values will
be type converted and added.
NB: This method should be capable of creating any array type, but if a
Collection interface or abstract class is provided we can only make
a best guess as to what container type to instantiate. Defaults are
provided for Set and List subclasses.
public <T> T convert(Object src, Class<T> dest)
ConverterString, which uses the
Object.toString() method instead). In the case of primitive types,
returns an object of the corresponding wrapped type. If the destination
type does not have an appropriate constructor, returns null.T - Type to which the object should be converted.src - The object to convert.dest - Type to which the object should be converted.public Class<Object> getOutputType()
Class this Converter produces as output.public Class<Object> getInputType()
Class this Converter accepts as input.@Deprecated public boolean canConvert(Class<?> src, Type dest)
ConvertercanConvert in interface Converter<Object,Object>canConvert in class AbstractConverter<Object,Object>Converter.convert(Object, Type)@Deprecated public boolean canConvert(Class<?> src, Class<?> dest)
ConvertercanConvert in interface Converter<Object,Object>canConvert in class AbstractConverter<Object,Object>Converter.convert(Object, Class)Copyright © 2015–2022 SciJava. All rights reserved.