Interface ModelMapperMappable
-
public interface ModelMapperMappableProvides a mapping definition between a business domain instance and a repository domain instance. Repository domain classes usually implement this interface in order to inform a
DomainMapperMember. The mapping described is facilitated with theModelMapperlibrary.Hierarchies within an item marked as
ModelMapperMappableshould almost always inherit their parent mapping usingTypeMap.includeBase(Class, Class). Example:public class JpaCustomer implements ModelMapperMappable { @NonNull public ModelMapper fromMe() { ModelMapper mapper } }- Author:
- Jeff Fischer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description org.modelmapper.ModelMapperfromMe()Return a mapper instance capable of transferring information from this domain type to a business domain type.default voidpostFromMe(ContextInfo contextInfo, Object businessDomain)Lifecycle method that is executed after mapping occurs from a repository entity to a business domain.default voidpostToMe(ContextInfo contextInfo, Object businessDomain)Lifecycle method that is executed after mapping occurs from a business domain to a repository entity.default voidpreFromMe(ContextInfo contextInfo, Object businessDomain)This is a lifecycle method and allows for any logic to be executed prior to the mapping occuring.default voidpreToMe(ContextInfo contextInfo, Object businessDomain)This is a lifecycle method and allows for any logic to be executed prior to the mapping occuring.org.modelmapper.ModelMappertoMe()Return a mapper instance capable of transferring information from a business domain type to this domain type.
-
-
-
Method Detail
-
fromMe
@NonNull org.modelmapper.ModelMapper fromMe()
Return a mapper instance capable of transferring information from this domain type to a business domain type.- Returns:
- The mapper instance
-
toMe
@NonNull org.modelmapper.ModelMapper toMe()
Return a mapper instance capable of transferring information from a business domain type to this domain type.- Returns:
- The mapper instance
-
preFromMe
default void preFromMe(@Nullable ContextInfo contextInfo, @NonNull Object businessDomain)This is a lifecycle method and allows for any logic to be executed prior to the mapping occuring. In particular, this can be used to set up state or transient data, createThreadLocalinstances as needed, or manually map specific values.- Parameters:
contextInfo-businessDomain-
-
preToMe
default void preToMe(@Nullable ContextInfo contextInfo, @NonNull Object businessDomain)This is a lifecycle method and allows for any logic to be executed prior to the mapping occuring. In particular, this can be used to set up state or transient data, createThreadLocalinstances as needed, or manually map specific values.- Parameters:
contextInfo-businessDomain-
-
postFromMe
default void postFromMe(@Nullable ContextInfo contextInfo, @NonNull Object businessDomain)Lifecycle method that is executed after mapping occurs from a repository entity to a business domain.- Parameters:
contextInfo-businessDomain-
-
postToMe
default void postToMe(@Nullable ContextInfo contextInfo, @NonNull Object businessDomain)Lifecycle method that is executed after mapping occurs from a business domain to a repository entity.- Parameters:
contextInfo-businessDomain-
-
-