Class OptionalToObjectConverter
java.lang.Object
io.beanmapper.core.converter.impl.OptionalToObjectConverter
- All Implemented Interfaces:
BeanConverter
This converter facilitates the conversion of an arbitrary amount of Optional wrappers, however, support for complex
datastructures, such as Maps, Sets, List, etc. is limited to a single layer. As such, if the user requires support
deeper layers of complex datastructures within Optionals, they should revise their system design, and if that does
not solve the problem, create a custom converters for their specific conversion.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<S,
T> T convert
(BeanMapper beanMapper, S source, Class<T> targetClass, BeanPropertyMatch beanPropertyMatch) Converts the source instance into the desired target type.boolean
Determines whether the conversion of our source type to a target type is supported by this converter.
-
Constructor Details
-
OptionalToObjectConverter
public OptionalToObjectConverter()
-
-
Method Details
-
convert
public <S,T> T convert(BeanMapper beanMapper, S source, Class<T> targetClass, BeanPropertyMatch beanPropertyMatch) Converts the source instance into the desired target type.- Specified by:
convert
in interfaceBeanConverter
- Parameters:
beanMapper
- the instance of BeanMapper to use for further mappingssource
- the source instancetargetClass
- the desired target typebeanPropertyMatch
- information on the field pair (source / target)- Returns:
- the converted source instance
-
match
Determines whether the conversion of our source type to a target type is supported by this converter.- Specified by:
match
in interfaceBeanConverter
- Parameters:
sourceClass
- the source classtargetClass
- the target class- Returns:
true
if the conversion is supported, elsefalse
-