@ConsumerType public interface ConverterFunction
This interface can also be used to register a custom error handler.
Modifier and Type | Field and Description |
---|---|
static java.lang.Object |
CANNOT_HANDLE
Special object to indicate that a custom converter rule or error handler
cannot handle the conversion.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
apply(java.lang.Object obj,
java.lang.reflect.Type targetType)
Convert the object into the target type.
|
static final java.lang.Object CANNOT_HANDLE
java.lang.Object apply(java.lang.Object obj, java.lang.reflect.Type targetType) throws java.lang.Exception
obj
- The object to be converted. This object will never be
null
as the convert function will not be invoked for
null values.targetType
- The target type.CANNOT_HANDLE
to indicate that
the convert function cannot handle this conversion. In this case
the next matching rule or parent converter will be given a
opportunity to convert.java.lang.Exception
- the operation can throw an exception if the conversion
can not be performed due to incompatible types.Copyright © OSGi Alliance (2000, 2018). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0