public class ConversionRequest extends Object
Converter
and ConvertService
methods.
ConversionRequest(java.lang.Object, java.lang.reflect.Type, java.lang.reflect.Type)
provides a variety of constructors. Note that only
one destination type needs to be set (e.g. either a Type
or a
Class
).
Only the Class
source needs to be set for Converter
lookup,
such as through HandlerService.getHandler(Object)
. However, to
perform an actual conversion, e.g. using
Converter.convert(ConversionRequest)
, you must provide an
Object
source.
NB: once a Converter
has been acquired, the ConversionRequest
used for lookup can be reused to cast to the same destination type, simply by
updating the source object using the setSourceObject(Object)
method.
Constructor and Description |
---|
ConversionRequest(Object src,
Type destType) |
ConversionRequest(Object src,
Type srcType,
Type destType) |
ConversionRequest(Type srcType,
Type destType) |
Modifier and Type | Method and Description |
---|---|
Class<?> |
destClass() |
Type |
destType() |
void |
setSourceObject(Object o)
Sets the source object for this
ConversionRequest . |
Class<?> |
sourceClass() |
Object |
sourceObject() |
Type |
sourceType() |
public Type sourceType()
public Class<?> sourceClass()
public Object sourceObject()
public Type destType()
public Class<?> destClass()
public void setSourceObject(Object o)
ConversionRequest
.IllegalArgumentException
- If the class of the provided object does
not match sourceClass()
.Copyright © 2015–2022 SciJava. All rights reserved.