Package org.osgi.util.converter
Class ConverterBuilderImpl
java.lang.Object
org.osgi.util.converter.ConverterBuilderImpl
- All Implemented Interfaces:
ConverterBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<ConverterFunction> private final InternalConverterprivate final List<ConverterFunction> private final Map<Type, List<ConverterFunction>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the specified converter.Register a custom error handler.private List<ConverterFunction> getRulesList(Type type) rule(Type t, 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.
-
Field Details
-
converter
-
rules
-
catchAllRules
-
errorHandlers
-
-
Constructor Details
-
ConverterBuilderImpl
-
-
Method Details
-
build
Description copied from interface:ConverterBuilderBuild the specified converter. Each time this method is called a new custom converter is produced based on the rules registered with the builder.- Specified by:
buildin interfaceConverterBuilder- Returns:
- A new converter with the rules provided to the builder.
-
errorHandler
Description copied from interface:ConverterBuilderRegister 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.- Specified by:
errorHandlerin interfaceConverterBuilder- Parameters:
func- The function to be used to handle errors.- Returns:
- This converter builder for further building.
-
rule
Description copied from interface:ConverterBuilderRegister a catch-all rule, will be called of no other rule matches.- Specified by:
rulein interfaceConverterBuilder- Parameters:
func- The function that will handle the conversion.- Returns:
- This converter builder for further building.
-
rule
Description copied from interface:ConverterBuilderRegister 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.- Specified by:
rulein interfaceConverterBuilder- Parameters:
t- The type that this rule will produce.func- The function that will handle the conversion.- Returns:
- This converter builder for further building.
-
rule
Description copied from interface:ConverterBuilderRegister a conversion rule for this converter.- Specified by:
rulein interfaceConverterBuilder- Parameters:
rule- A rule implementation.- Returns:
- This converter builder for further building.
-
getRulesList
-