Class CustomerMapper

java.lang.Object
de.calamanari.pk.mapper.AbstractMapper
de.calamanari.pk.mapper.CustomerMapper

public class CustomerMapper
extends AbstractMapper
Customer Mapper - demonstrates MAPPER pattern
In the first subsystem there exists a Person entity and an address entity.
For some reason in a second subsystem a Customer entity exists including address information.
This mapper is responsible for transparently mapping data between the two without giving one subsystem any knowledge of the other one.
Neither of the subsystems is aware of the mapper.
Author:
Karl Eilebrecht
  • Constructor Summary

    Constructors
    Constructor Description
    CustomerMapper​(Person person, Address address, Customer customer)
    Creates new customer mapper for the two entities from the first subsystem and the customer entity from the second subsystem
  • Method Summary

    Modifier and Type Method Description
    void map()
    Maps data from the first subsystem's representation to the second one
    void mapBack()
    Maps data from the second subsystem's representation back to the first one

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CustomerMapper

      public CustomerMapper​(Person person, Address address, Customer customer)
      Creates new customer mapper for the two entities from the first subsystem and the customer entity from the second subsystem
      Parameters:
      person - the person to be mapped
      address - the address to be mapped
      customer - the customer to be mapped
  • Method Details

    • map

      public void map()
      Description copied from class: AbstractMapper
      Maps data from the first subsystem's representation to the second one
      Specified by:
      map in class AbstractMapper
    • mapBack

      public void mapBack()
      Description copied from class: AbstractMapper
      Maps data from the second subsystem's representation back to the first one
      Specified by:
      mapBack in class AbstractMapper