Package ma.glasnost.orika

Examples of ma.glasnost.orika.MapperFacade.map()


      source.value = 2;
     
      MapperFactory factory = MappingUtil.getMapperFactory();
        MapperFacade mapper = factory.getMapperFacade();
     
      IntHolder dest = mapper.map(source, IntHolder.class);
      assertEquals(source.value, dest.value);
     
      ShortHolder mapBack = mapper.map(dest, ShortHolder.class);
      assertEquals(source.value, mapBack.value);
  }
View Full Code Here


      Book book = createBook(hiddenBookType);
      book.setAuthor(createAuthor(hiddenAuthorType));
      Library lib = createLibrary(hiddenLibraryType);
      lib.getBooks().add(book);
     
      mappedLib = mapper.map(lib, LibraryMyDTO.class);
     
      // Just to be sure things mapped as expected
      Assert.assertEquals(lib.getTitle(),mappedLib.getMyTitle());
      Assert.assertEquals(book.getTitle(),mappedLib.getMyBooks().get(0).getMyTitle());
      Assert.assertEquals(book.getAuthor().getName(),mappedLib.getMyBooks().get(0).getMyAuthor().getMyName());
View Full Code Here

        MapperFacade mapper = factory.getMapperFacade();
     
      IntHolder dest = mapper.map(source, IntHolder.class);
      assertEquals(source.value, dest.value);
     
      ShortHolder mapBack = mapper.map(dest, ShortHolder.class);
      assertEquals(source.value, mapBack.value);
  }
 
    @Test
    public void long_short() {
View Full Code Here

        source.value = 2;
       
        MapperFactory factory = MappingUtil.getMapperFactory();
        MapperFacade mapper = factory.getMapperFacade();
       
        LongHolder dest = mapper.map(source, LongHolder.class);
        assertEquals(source.value, dest.value);
       
        ShortHolder mapBack = mapper.map(dest, ShortHolder.class);
        assertEquals(source.value, mapBack.value);
    }
View Full Code Here

        MapperFacade mapper = factory.getMapperFacade();
       
        LongHolder dest = mapper.map(source, LongHolder.class);
        assertEquals(source.value, dest.value);
       
        ShortHolder mapBack = mapper.map(dest, ShortHolder.class);
        assertEquals(source.value, mapBack.value);
    }
   
    @Test
    public void long_int() {
View Full Code Here

        source.value = 2;
       
        MapperFactory factory = MappingUtil.getMapperFactory();
        MapperFacade mapper = factory.getMapperFacade();
       
        LongHolder dest = mapper.map(source, LongHolder.class);
        assertEquals(source.value, dest.value);
       
        IntHolder mapBack = mapper.map(dest, IntHolder.class);
        assertEquals(source.value, mapBack.value);
    }
View Full Code Here

        MapperFacade mapper = factory.getMapperFacade();
       
        LongHolder dest = mapper.map(source, LongHolder.class);
        assertEquals(source.value, dest.value);
       
        IntHolder mapBack = mapper.map(dest, IntHolder.class);
        assertEquals(source.value, mapBack.value);
    }
 
 
  public static class IntHolder {
View Full Code Here

    MapperFactory factory = MappingUtil.getMapperFactory();
    factory.getConverterFactory().registerConverter(new ConstructorConverter());
    MapperFacade mapper = factory.getMapperFacade();
   
    String urlString = "http://localhost:80/index.html";
    URL url = mapper.map(urlString, URL.class);
    Assert.assertNotNull(url);
    Assert.assertEquals(urlString, url.toExternalForm());
  }
 
  @Test
View Full Code Here

    MapperFactory factory = MappingUtil.getMapperFactory();
    factory.getConverterFactory().registerConverter(new ConstructorConverter());
    MapperFacade mapper = factory.getMapperFacade();
   
    Double doubleValue = Double.valueOf("4.99");
    BigDecimal bd = mapper.map(doubleValue, BigDecimal.class);
    Assert.assertNotNull(bd);
    Assert.assertEquals(doubleValue, bd.doubleValue());
  }
 
 
View Full Code Here

      Library library = new LibraryImpl("Library #1", books);
     
      MapperFactory factory = MappingUtil.getMapperFactory();
      MapperFacade mapper = factory.getMapperFacade();
     
      LibraryDTO mapped = mapper.map(library, LibraryDTO.class);
     
      assertValidMapping(library,mapped);
     
      Library libraryMapBack = mapper.map(mapped, LibraryImpl.class);
     
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.