@ConsumerType public interface Converter
Modifier and Type | Method and Description |
---|---|
boolean |
canConvert(Object sourceObject,
ReifiedType targetType)
Return if this converter is able to convert the specified object to the
specified type.
|
Object |
convert(Object sourceObject,
ReifiedType targetType)
Convert the specified object to an instance of the specified type.
|
boolean canConvert(Object sourceObject, ReifiedType targetType)
sourceObject
- The source object s
to convert.targetType
- The target type T
.true
if the conversion is possible, false
otherwise.Object convert(Object sourceObject, ReifiedType targetType) throws Exception
sourceObject
- The source object s
to convert.targetType
- The target type T
.Exception
- If the conversion cannot succeed. This exception should
not be thrown when the canConvert
method has returned true
.Copyright © OSGi Alliance (2000, 2015). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0