Interface ModelMapperMappable


  • public interface ModelMapperMappable

    Provides 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 the ModelMapper library.

    Hierarchies within an item marked as ModelMapperMappable should almost always inherit their parent mapping using TypeMap.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.ModelMapper fromMe()
      Return a mapper instance capable of transferring information from this domain type to a business domain type.
      default void postFromMe​(ContextInfo contextInfo, Object businessDomain)
      Lifecycle method that is executed after mapping occurs from a repository entity to a business domain.
      default void postToMe​(ContextInfo contextInfo, Object businessDomain)
      Lifecycle method that is executed after mapping occurs from a business domain to a repository entity.
      default void preFromMe​(ContextInfo contextInfo, Object businessDomain)
      This is a lifecycle method and allows for any logic to be executed prior to the mapping occuring.
      default void preToMe​(ContextInfo contextInfo, Object businessDomain)
      This is a lifecycle method and allows for any logic to be executed prior to the mapping occuring.
      org.modelmapper.ModelMapper toMe()
      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, create ThreadLocal instances 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, create ThreadLocal instances 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 -