Package ma.glasnost.orika

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


     
      LibraryDTO mapped = mapper.map(library, LibraryDTO.class);
     
      assertValidMapping(library,mapped);
     
      Library libraryMapBack = mapper.map(mapped, LibraryImpl.class);
     
      assertValidMapping(libraryMapBack,mapped);
     
    }
   
View Full Code Here


          factory.classMap(AuthorNested.class, AuthorDTO.class)
            .field("name.fullName", "name").byDefault().toClassMap());
   
      MapperFacade mapper = factory.getMapperFacade();
     
      LibraryDTO mapped = mapper.map(library, LibraryDTO.class);
     
      assertValidMapping(library,mapped);
     
      /*
      // this situation is a bit too complicated to handle normally;
View Full Code Here

        MapperFacade mapperFacade = mapperFactory.getMapperFacade();

        A a = new A();
        a.setStrings(new String[] { "4" });

        B b = mapperFacade.map(a, B.class);
        assertEquals(asList("4"), b.getStrings());
    }

    @Test
    public void testListOfStringToStringArray() {
View Full Code Here

      dto1.protocolX = "http";
      dto1.hostX = "somewhere.com";
      dto1.portX = 8080;
      dto1.fileX = "index.html";
     
      URL url = mapper.map(dto1, URL.class);
      Assert.assertNotNull(url);
      Assert.assertEquals(dto1.protocolX, url.getProtocol());
      Assert.assertEquals(dto1.hostX, url.getHost());
      Assert.assertEquals(dto1.portX, url.getPort());
     
View Full Code Here

        MapperFacade mapperFacade = mapperFactory.getMapperFacade();

        B b = new B();
        b.setStrings(asList("5"));

        A a = mapperFacade.map(b, A.class);
        assertArrayEquals(new String[] { "5" }, a.getStrings());
    }

    @Test
    public void testIntArrayToListOfInteger() {
View Full Code Here

        MapperFacade mapperFacade = mapperFactory.getMapperFacade();

        A a = new A();
        a.setInts(new int[] { 4 });

        B b = mapperFacade.map(a, B.class);
        assertNotNull(b.getIntegers());
        assertEquals(1, b.getIntegers().size());
        assertEquals(Integer.class, b.getIntegers().get(0).getClass());
        assertEquals(Integer.valueOf(4), b.getIntegers().get(0));
    }
View Full Code Here

        MapperFacade mapperFacade = mapperFactory.getMapperFacade();

        B b = new B();
        b.setIntegers(asList(Integer.valueOf(6)));

        A a = mapperFacade.map(b, A.class);
        assertArrayEquals(new int[] { 6 }, a.getInts());
    }

    @Test
    public void testIntegerArrayToListOfInteger() {
View Full Code Here

        MapperFacade mapperFacade = mapperFactory.getMapperFacade();

        A a = new A();
        a.setIntegers(new Integer[] { 4 });

        B b = mapperFacade.map(a, B.class);
        assertNotNull(b.getIntegers());
        assertEquals(1, b.getIntegers().size());
        assertEquals(Integer.class, b.getIntegers().get(0).getClass());
        assertEquals(Integer.valueOf(4), b.getIntegers().get(0));
    }
View Full Code Here

        MapperFacade mapperFacade = mapperFactory.getMapperFacade();

        B b = new B();
        b.setIntegers(asList(Integer.valueOf(7)));

        A a = mapperFacade.map(b, A.class);
        assertArrayEquals(new Integer[] { 7 }, a.getIntegers());
    }

}
View Full Code Here

        a.name1 = "a1";
        a.name2 = "a2";
        a.name3 = "a3";
     
       
        B3 b = mapper.map(a, B3.class);
       
        Assert.assertNotNull(b);
        Assert.assertEquals(a.name1, b.name1);
        Assert.assertEquals(a.name2, b.name2);
    }
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.