Package manifold.ext.rt.api
Interface ICoercionProvider
-
public interface ICoercionProviderImplement this interface to handle coercions during dynamic proxy invocation, such as with JSON Schema marshalling. Note if you intend to implement JSON coercions you should instead implementIJsonFormatTypeCoercer.See
IJsonFormatTypeCoercer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Objectcoerce(Object value, Type type)Coercevaluetotype.ObjecttoBindingValue(Object value)Coercevalueparameter to a value suitable for aBindingse.g., a JSON bindings.
-
-
-
Method Detail
-
coerce
Object coerce(Object value, Type type)
Coercevaluetotype. ReturnICallHandler.UNHANDLEDif 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.- Parameters:
value- A value to coerce, typically a String.type- The type to convert to.- Returns:
- A value of the specified
typeorICallHandler.UNHANDLEDif this provider does not handle the coercion.
-
toBindingValue
Object toBindingValue(Object value)
Coercevalueparameter to a value suitable for aBindingse.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.- Parameters:
value- A value to coerce.- Returns:
- A value suitable for a
BindingsorICallHandler.UNHANDLEDif 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 aLocalDateTimein the Java API.
-
-