Package org.dozer.loader.api

Examples of org.dozer.loader.api.BeanMappingBuilder


    assertThat(result.myDouble, equalTo(new BigDecimal("1.0")));
  }

  @Test
  public void shouldMapOneWayOnly() {
    mapper.addMapping(new BeanMappingBuilder() {
      @Override
      protected void configure() {
        mapping(type(Source.class),
                type(Destination.class)
                 , TypeMappingOptions.oneWay()
View Full Code Here


    @Override
    public void setUp() throws Exception {
        super.setUp();
        DozerBeanMapper mapper = createCleanMapper();
        DozerTypeConverterLoader loader = new DozerTypeConverterLoader(context, mapper);
        loader.addMapping(new BeanMappingBuilder() {
            @Override
            protected void configure() {
                mapping(CustomerDTO.class, Customer.class);
            }
        });
View Full Code Here

public class DozerMapperFactory {

    @Produces
    @ApplicationScoped
    public Mapper getMapper() {
        BeanMappingBuilder builder = new BeanMappingBuilder() {
            protected void configure() {

                mapping(org.archfirst.bfoms.domain.security.User.class,
                        org.archfirst.bfoms.webservice.security.User.class)
                    .fields("person.firstName", "firstName")
View Full Code Here

  }

  @Test(expected = IllegalArgumentException.class)
  public void shouldFailOnDuplicateMapping() {
    DozerBeanMapper mapper = new DozerBeanMapper();
    mapper.addMapping(new BeanMappingBuilder() {
      @Override
      protected void configure() {
        mapping(String.class, NoNothing.class);
      }
    });

    mapper.addMapping(new BeanMappingBuilder() {
      @Override
      protected void configure() {
        mapping(String.class, NoNothing.class);
      }
    });
View Full Code Here

     * Get the parent mapping for to use for the test
     * @param clazz
     * @return
     */
    private BeanMappingBuilder getParentMapping(final Class<?> clazz) {
        return new BeanMappingBuilder() {
            protected void configure() {
                mapping(
                        clazz,
                        clazz,
                        TypeMappingOptions.mapId(MAP_ID_PATENT)
View Full Code Here

    /**
     * Get the child mapping to use for the test, it is configured not to map nulls.
     * @return
     */
    private BeanMappingBuilder getChildMapping() {
        return new BeanMappingBuilder() {
            protected void configure() {
                mapping(
                        Child.class,
                        Child.class,
                        TypeMappingOptions.mapId(MAP_ID_CHILD),
View Full Code Here

    destination = new Destination();
  }

  @Test
  public void shouldMapNull() {
    beanMapper.addMapping(new BeanMappingBuilder() {
      @Override
      protected void configure() {
        mapping(Source.class, Destination.class, TypeMappingOptions.mapNull(true))
                .fields("a", "b");
      }
View Full Code Here

    assertThat(destination.getB(), nullValue());
  }

  @Test
  public void shouldMapEmptyString() {
    beanMapper.addMapping(new BeanMappingBuilder() {
      @Override
      protected void configure() {
        mapping(Source.class, Destination.class, TypeMappingOptions.mapEmptyString(true))
                .fields("a", "b");
      }
View Full Code Here

  }

  @Test
  public void testApi() {

    BeanMappingBuilder builder = new BeanMappingBuilder() {
      protected void configure() {
        mapping(Bean.class, Bean.class,
                TypeMappingOptions.oneWay(),
                mapId("A"),
                mapNull()
View Full Code Here

    mapper.map(1, String.class);
  }

  @Test
  public void shouldHaveIterateType() {
    BeanMappingBuilder builder = new BeanMappingBuilder() {
      @Override
      protected void configure() {
        mapping(type(IterateBean.class), type(IterateBean2.class))
                .fields(
                        field("integers"),
View Full Code Here

TOP

Related Classes of org.dozer.loader.api.BeanMappingBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.