Package ma.glasnost.orika

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


   
   
    /*
     * Mapping Source to Dest2 causes a mapping to be created
     */
    Dest2 dest2 = mapper.map(src, Dest2.class);
    /*
     * SourceChild is able to use this mapping, so the resolved
     * type in this case for SourceChild is 'Source', which
     * gets cached in resolvedTypes
     */
 
View Full Code Here


    /*
     * SourceChild is able to use this mapping, so the resolved
     * type in this case for SourceChild is 'Source', which
     * gets cached in resolvedTypes
     */
    Dest2 dest2B = mapper.map(srcChild, Dest2.class);
   
   
    Assert.assertNotNull(dest2);
    Assert.assertNotNull(dest2B);
   
View Full Code Here

    /*
     * But now, since the resolvedType for 'SourceChild' has
     * been cached as 'Source', it cannot find the converter
     * which has been specifically created for 'SourceChild'
     */
    Dest1 dest1 = mapper.map(srcChild, Dest1.class);
    Assert.assertNotNull(dest1);
  }
}
View Full Code Here

 
    mapperFactory.getConverterFactory().registerConverter(new OrderIDConverter());
    MapperFacade facade = mapperFactory.getMapperFacade();
   
    OrderData data = new OrderData(1234l);
    Order order = facade.map(data, Order.class);
    Assert.assertEquals(new OrderID(1234l), order.getEntityID());
  }
}
View Full Code Here

        DefaultMapperFactory.Builder builder = new DefaultMapperFactory.Builder();
        MapperFactory factory = builder.build();
        MapperFacade mapperFacade = factory.getMapperFacade();
        Entity entity = new Entity();
        entity.setState(State.B);
        final Dto dto = mapperFacade.map(entity, Dto.class);
        Assert.assertEquals(dto.getState(), entity.getState());
    }
   
    public static enum State {
        A {
View Full Code Here

       
        DomainObjectDto dto = new DomainObjectDto();
        dto.setDate(new Date());
        dto.setValue(-2L);
       
        mapper.map(dto, DomainObject.class);
    }
}
View Full Code Here

        MapperFacade mapper = MappingUtil.getMapperFactory().getMapperFacade();
       
        Book book = createBook(BookChild.class);
        book.setAuthor(createAuthor(AuthorChild.class));
       
        BookMyDTO mappedBook = mapper.map(book, BookMyDTO.class);
       
        Assert.assertNotNull(mappedBook);
        Assert.assertNull(mappedBook.getMyTitle());
        Assert.assertNull(mappedBook.getMyAuthor());
    }
View Full Code Here

        Book book = createBook(BookParent.class);
        book.setAuthor(createAuthor(AuthorParent.class));
        Library lib = createLibrary(LibraryParent.class);
        lib.getBooks().add(book);
       
        LibraryMyDTO mappedLib = mapper.map(lib, LibraryMyDTO.class);
       
        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

        Book book = createBook(BookChild.class);
        book.setAuthor(createAuthor(AuthorChild.class));
        Library lib = createLibrary(LibraryChild.class);
        lib.getBooks().add(book);
       
        LibraryMyDTO mappedLib = mapper.map(lib, LibraryMyDTO.class);
       
        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();
       
        Book book = createBook(BookChild.class);
        book.setAuthor(createAuthor(AuthorChild.class));
       
        BookMyDTO mappedBook = mapper.map(book, BookMyDTO.class);
       
        Assert.assertEquals(book.getTitle(), mappedBook.getMyTitle());
        Assert.assertEquals(book.getAuthor().getName(), mappedBook.getMyAuthor().getMyName());
    }
   
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.