public static com.intuit.ipp.data.Customer buildQBOObject(Customer pSalesReceipt) {

    if (pSalesReceipt == null) {
      return null;
    }

    final com.intuit.ipp.data.Customer qboCustomer = domainToQBOMapper.map(pSalesReceipt);

    return qboCustomer;
  }
Example #2
0
 public static RESTShow transformRESTShow(final Show input) {
   return REST_SHOW_MAPPER_FACADE.map(input);
 }
Example #3
0
 public static Show transformShow(final RESTShow input) {
   return SHOW_MAPPER_FACADE.map(input);
 }
 public Object fromDto(final Object dto) {
   Person entity = new Person();
   mapper.mapReverse((PersonDTO) dto, entity);
   return entity;
 }
 public Object fromEntity(final Object entity) {
   PersonDTO dto = new PersonDTO();
   mapper.map((Person) entity, dto);
   return dto;
 }
  @Test
  public void shouldUseOnlyOneDirectionMapping() {
    // given
    MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();

    mapperFactory
        .classMap(BasicPerson.class, BasicPersonDto.class)
        .fieldAToB("name", "fullName")
        .field("age", "currentAge")
        .field("birthDate", "birthDate")
        .register();

    BasicPerson bpSrc = createBasicPerson("Jan", 20, Calendar.getInstance().getTime());

    BasicPersonDto bpDtoSrc = new BasicPersonDto();
    bpDtoSrc.setFullName("Jan");
    bpDtoSrc.setCurrentAge(20);
    bpDtoSrc.setBirthDate(Calendar.getInstance().getTime());

    // when
    BoundMapperFacade<BasicPerson, BasicPersonDto> boundMapper =
        mapperFactory.getMapperFacade(BasicPerson.class, BasicPersonDto.class);

    BasicPersonDto bpDtoDest = boundMapper.map(bpSrc);
    BasicPerson bpDest = boundMapper.mapReverse(bpDtoSrc);

    // then
    assertThat(bpDtoDest.getCurrentAge()).isEqualTo(bpSrc.getAge());
    assertThat(bpDtoDest.getFullName()).isEqualTo(bpSrc.getName());
    assertThat(bpDtoDest.getBirthDate()).isEqualTo(bpSrc.getBirthDate());

    assertThat(bpDest.getAge()).isEqualTo(bpDtoSrc.getCurrentAge());
    assertThat(bpDest.getName()).isNull();
    assertThat(bpDest.getBirthDate()).isEqualTo(bpDtoSrc.getBirthDate());
  }