Interface Converter<S,T>
- Type Parameters:
S
- the source typeT
- the target type
- All Known Implementing Classes:
DeserializingConverter
,SerializingConverter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Converter<S,T>
A converter converts a source object of typeS
to a target of typeT
.Implementations of this interface are thread-safe and can be shared.
Implementations may additionally implement
ConditionalConverter
.- Since:
- 3.0
- Author:
- Keith Donald
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
convert(S source)
Convert the source object of typeS
to target typeT
.
Method Detail
convert
@Nullable T convert(S source)
Convert the source object of typeS
to target typeT
.- Parameters:
source
- the source object to convert, which must be an instance ofS
(nevernull
)- Returns:
- the converted object, which must be an instance of
T
(potentiallynull
) - Throws:
IllegalArgumentException
- if the source cannot be converted to the desired target type