A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Code Examples of DozerBeanMapper


    mapper.map("", NoNothing.class);
  }

  @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);
      }
    });
    
    mapper.map("A", NoNothing.class);
  }

  public static class NoNothing {
  }

View Full Code Here


   * test mapping of a generic field
   */
  @Test
  public void testSimpleGenerics() {

    Mapper mapper = new DozerBeanMapper();

    A a = new A();
    a.setId(15L);

    B b = mapper.map(a, B.class);
    Assert.assertEquals((Integer) a.getId().intValue(), b.getId());

    A a2 = mapper.map(a, A.class);
    Assert.assertEquals(a.getId(), a2.getId());

  }

  /**

View Full Code Here


    }

    // get mapper
    List<String> mappingFiles = new ArrayList<String>();
    mappingFiles.add("interface-recursion-mappings.xml");
    Mapper mapper = new DozerBeanMapper(mappingFiles);

    // do mapping
    UserGroupPrime userGroupPrime = null;
    try {
      userGroupPrime = mapper.map(userGroup, UserGroupPrime.class);
    } catch (StackOverflowError e) {
      fail("Recursive mapping caused a stack overflow.");
    }

    // check mapped group

View Full Code Here



  private DozerBeanMapper mapper;

  @Before
  public void setUp() {
    mapper = new DozerBeanMapper();
  }

  @Test
  public void shouldHandleCircularDependencies() {
    A a = newInstance(A.class);

View Full Code Here


  private TestA testA;
  private TestB testB;

  @Before
  public void setUp() {
    mapper = new DozerBeanMapper(Arrays.asList(new String[] { getMappingFile() }));
    testA = newInstance(TestA.class);
    testA.setOne("one");
    testA.setOneA("oneA");
    testB = null;
  }

View Full Code Here



  @Test
  public void testClassloader() {
    ArrayList<String> files = new ArrayList<String>();
    files.add("classloader.xml");
    mapper = new DozerBeanMapper(files);
    assertNotNull(mapper);
  }

}

View Full Code Here


  private DozerBeanMapper mapper;
  private A source;

  @Before
  public void setUp() {
    mapper = new DozerBeanMapper();

    source = new A();
    source.property1 = "1";
    source.property2 = "2";
  }

View Full Code Here



  private DozerBeanMapper mapper;

  @Before
  public void setUp() {
    mapper = new DozerBeanMapper();
  }

  @Test
  public void testApi() {

View Full Code Here



  private DozerBeanMapper mapper;

  @Before
  public void setUp() {
    mapper = new DozerBeanMapper();
  }


  @Test
  public void shouldDetermineCollectionTypeViaFieldGenericType() {

View Full Code Here



  private DozerBeanMapper mapper;

  @Before
  public void setUp() {
    mapper = new DozerBeanMapper();
  }

  @Test
  public void shouldMapPrimitiveTypes() throws Exception {
    Source source = new Source();

View Full Code Here



  private DozerBeanMapper beanMapper;

  @Before
  public void setUp() {
    beanMapper = new DozerBeanMapper();

  }

  @Test
  public void shouldPerformSimpleMapping() {

View Full Code Here



  private DozerBeanMapper beanMapper;

  @Before
  public void setUp() {
    beanMapper = new DozerBeanMapper();
  }

  @Test
  public void dateFormat() {
    DateFormat instance = SimpleDateFormat.getInstance();

View Full Code Here



  @Before
  public void setUp() throws Exception {
    System.setProperty("log4j.debug", "true");
    System.setProperty(DozerConstants.DEBUG_SYS_PROP, "true");
    mapper = new DozerBeanMapper();
  }

  protected Mapper getMapper(String ... mappingFiles) {
    List<String> list = new ArrayList<String>();
    if (mappingFiles != null) {

View Full Code Here



  DozerBeanMapper mapper;

  @Before
  public void setup() {
    mapper = new DozerBeanMapper();
    List<String> mappingFileUrls = new ArrayList<String>();
    mappingFileUrls.add("mapper-aware.xml");

    Map<String, CustomConverter> customConvertersWithId = new HashMap<String, CustomConverter>();
    customConvertersWithId.put("associationConverter", new AssociatedEntityConverter());

View Full Code Here



  // ==================================================================================================================================
  // interface 'InitializingBean'
  // ==================================================================================================================================
  public final void afterPropertiesSet() throws Exception {
    this.beanMapper = new DozerBeanMapper();

    if (this.mappingFiles != null) {
      final List<String> mappings = new ArrayList<String>(this.mappingFiles.length);
      for (Resource mappingFile : this.mappingFiles) {
        mappings.add(mappingFile.getURL().toString());

View Full Code Here


    public static CustomerDTO createDtoCustomer() {
        return new CustomerDTO("Bob", "Roberts", new AddressDTO("12345", "1 main st"));
    }

    public static DozerBeanMapper createMapper() {
        return new DozerBeanMapper(Arrays.asList(new String[]{"mapping.xml"}));
    }

    public static DozerBeanMapper createCleanMapper() {
        return new DozerBeanMapper();
    }

View Full Code Here

TOP

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

TOP