Interface TypeConverter<X,Y>
- Type Parameters:
X- The underlying type supported by the entity view type systemY- The type in the entity view model for which this converter adds support
public interface TypeConverter<X,Y>
A contract for a converter to convert between an entity view model type and an underlying type.
- Since:
- 1.2.0
- Author:
- Christian Beikov
-
Method Summary
Modifier and TypeMethodDescriptionconvertToUnderlyingType(Y object) Converts the object from entity view model type to the underlying type.convertToViewType(X object) Converts the object from underlying type to the entity view model type.Class<?>getUnderlyingType(Class<?> owningClass, Type declaredType) Extract the underlying type from the declared type.
-
Method Details
-
getUnderlyingType
Extract the underlying type from the declared type. The owning class is the concrete entity view class which contains a field or method of the declared type.- Parameters:
owningClass- The class owning the declared typedeclaredType- The declared type as present in the entity view model- Returns:
- The actual underlying type
-
convertToViewType
Converts the object from underlying type to the entity view model type.- Parameters:
object- The object to convert- Returns:
- The converted object
-
convertToUnderlyingType
Converts the object from entity view model type to the underlying type.- Parameters:
object- The object to convert- Returns:
- The converted object
-