public interface ICoercionProvider
IJsonFormatTypeCoercer
.
See IJsonFormatTypeCoercer
Modifier and Type | Method and Description |
---|---|
Object |
coerce(Object value,
Type type)
Coerce
value to type . |
Object |
toBindingValue(Object value)
Coerce
value parameter to a value suitable for a Bindings e.g., a JSON bindings. |
Object coerce(Object value, Type type)
value
to type
. Return ICallHandler.UNHANDLED
if not coerced.
It is imperative that this method coerces only between the JSON types and Java types it explicitly
handles otherwise you may inadvertently perform a coercion that is incorrect that is better handled
by another coercion provider.value
- A value to coerce, typically a String.type
- The type to convert to.type
or ICallHandler.UNHANDLED
if this provider does not handle
the coercion.Object toBindingValue(Object value)
value
parameter to a value suitable for a Bindings
e.g., a JSON bindings.
It is imperative that this method coerces only between the JSON types and Java types it explicitly
handles otherwise you may inadvertently perform a coercion that is incorrect that is better handled
by another coercion provider.value
- A value to coerce.Bindings
or ICallHandler.UNHANDLED
if this provider does not handle the coercion. For example, the coerced value is typically a String when dealing
with JSON Schema formats such as "date-time"
where the value persists in the bindings as a String, but
surfaces as a LocalDateTime
in the Java API.Copyright © 2024. All rights reserved.