?? ConverterBuilder
@ProviderType
public interface ConverterBuilder
A builder to create a new converter with modified behavior based on an
existing converter. The modified behavior is specified by providing rules
and/or conversion functions. If multiple rules match they will be visited in
sequence of registration. If a rule's function returns
null
the next
rule found will be visited. If none of the rules can handle the conversion,
the original converter will be used to perform the conversion.-
????
??????????build()
Build the specified converter.Register a custom error handler.rule
(Type type, ConverterFunction func) Register a conversion rule for this converter.rule
(ConverterFunction func) Register a catch-all rule, will be called of no other rule matches.rule
(TargetRule rule) Register a conversion rule for this converter.
-
??????
-
build
Converter build()Build the specified converter. Each time this method is called a new custom converter is produced based on the rules registered with the builder.- ??:
- A new converter with the rules provided to the builder.
-
errorHandler
Register a custom error handler. The custom error handler will be called when the conversion would otherwise throw an exception. The error handler can either throw a different exception or return a value to be used for the failed conversion.- ??:
func
- The function to be used to handle errors.- ??:
- This converter builder for further building.
-
rule
Register a conversion rule for this converter. Note that only the target type is specified, so the rule will be visited for every conversion to the target type.- ??:
type
- The type that this rule will produce.func
- The function that will handle the conversion.- ??:
- This converter builder for further building.
-
rule
Register a conversion rule for this converter.- ??:
rule
- A rule implementation.- ??:
- This converter builder for further building.
-
rule
Register a catch-all rule, will be called of no other rule matches.- ??:
func
- The function that will handle the conversion.- ??:
- This converter builder for further building.
-