Examples of classMap()


Examples of ma.glasnost.orika.MapperFactory.classMap()

   
    @Test
    public void testFail() {
        MapperFactory factory = new DefaultMapperFactory.Builder().build();
       
        factory.registerClassMap(factory.classMap(Base.class, BaseDto.class).customize(new CustomMapper<Base, BaseDto>() {
            @Override
            public void mapAtoB(Base base, BaseDto baseDto, MappingContext context) {
                baseDto.setBaseField(base.getBaseTrickField());
            }
        }).toClassMap());
View Full Code Here

Examples of ma.glasnost.orika.MapperFactory.classMap()

    @Test
    public void testFindConstructor() throws Throwable {
      final SimpleDateFormat df = new SimpleDateFormat(DATE_PATTERN);
        MapperFactory factory = MappingUtil.getMapperFactory();
       
        factory.registerClassMap(factory.classMap(PersonVO3.class, Person.class)
                .fieldMap("dateOfBirth", "date").converter(DATE_CONVERTER).add()
                .byDefault()
                .toClassMap());
        factory.getConverterFactory().registerConverter(DATE_CONVERTER, new DateToStringConverter(DATE_PATTERN));
       
View Full Code Here

Examples of ma.glasnost.orika.MapperFactory.classMap()

            @Override
            public void mapAtoB(Base base, BaseDto baseDto, MappingContext context) {
                baseDto.setBaseField(base.getBaseTrickField());
            }
        }).toClassMap());
        factory.registerClassMap(factory.classMap(Child.class, ChildDto.class).byDefault().toClassMap());
       
        Child child = new Child();
        child.setChildField("CHILD FIELD");
        child.setBaseTrickField("BASE FIELD");
       
View Full Code Here

Examples of ma.glasnost.orika.MapperFactory.classMap()

    @Test
    public void testFindConstructor2() throws Throwable {
      final SimpleDateFormat df = new SimpleDateFormat(DATE_PATTERN);
        MapperFactory factory = MappingUtil.getMapperFactory();
       
        factory.registerClassMap(factory.classMap(PersonVO3.class, Person.class)
                .field("firstName", "firstName")
                .field("lastName", "lastName")
            .field("dateOfBirth", "date"));
        factory.getConverterFactory().registerConverter(DATE_CONVERTER, new DateToStringConverter(DATE_PATTERN));
       
View Full Code Here

Examples of ma.glasnost.orika.MapperFactory.classMap()

    public void testReuse() {
       
        MapperFactory factory = MappingUtil.getMapperFactory();
       
        {
            ClassMapBuilder<Location, LocationDTO> builder = factory.classMap(Location.class, LocationDTO.class);
            builder.field("x", "coordinateX").field("y", "coordinateY");
            factory.registerClassMap(builder.toClassMap());
           
        }
       
View Full Code Here

Examples of ma.glasnost.orika.MapperFactory.classMap()

            factory.registerClassMap(builder.toClassMap());
           
        }
       
        {
            ClassMapBuilder<NamedLocation, NamedLocationDTO> builder = factory.classMap(NamedLocation.class, NamedLocationDTO.class);
            builder.use(Location.class, LocationDTO.class).field("name", "label");
            factory.registerClassMap(builder.toClassMap());
        }
       
        {
View Full Code Here

Examples of ma.glasnost.orika.MapperFactory.classMap()

            builder.use(Location.class, LocationDTO.class).field("name", "label");
            factory.registerClassMap(builder.toClassMap());
        }
       
        {
            ClassMapBuilder<City, CityDTO> builder = factory.classMap(City.class, CityDTO.class);
            builder.use(NamedLocation.class, NamedLocationDTO.class).byDefault();
            factory.registerClassMap(builder.toClassMap());
        }
       
       
View Full Code Here

Examples of ma.glasnost.orika.MapperFactory.classMap()

   
    @Test
    public void testNestedInheritance() {
        MapperFactory factory = MappingUtil.getMapperFactory();
       
        factory.registerClassMap(factory.classMap(Person.class, PersonDTO.class).byDefault().toClassMap());
        factory.registerClassMap(factory.classMap(Client.class, ClientDTO.class).byDefault().toClassMap());
        factory.registerClassMap(factory.classMap(Subscription.class, SubscriptionDTO.class).field("client", "person").toClassMap());
       
        Client client = new Client();
        client.setName("Khalil Gebran");
View Full Code Here

Examples of ma.glasnost.orika.MapperFactory.classMap()

     
      LibraryNested library = new LibraryNested("Library #1", books);
     
      MapperFactory factory = MappingUtil.getMapperFactory();
      factory.registerClassMap(
          factory.classMap(AuthorNested.class, AuthorDTO.class)
            .field("name.fullName", "name").byDefault().toClassMap());
   
      MapperFacade mapper = factory.getMapperFacade();
     
      LibraryDTO mapped = mapper.map(library, LibraryDTO.class);
View Full Code Here

Examples of ma.glasnost.orika.MapperFactory.classMap()

    @Test
    public void testNestedInheritance() {
        MapperFactory factory = MappingUtil.getMapperFactory();
       
        factory.registerClassMap(factory.classMap(Person.class, PersonDTO.class).byDefault().toClassMap());
        factory.registerClassMap(factory.classMap(Client.class, ClientDTO.class).byDefault().toClassMap());
        factory.registerClassMap(factory.classMap(Subscription.class, SubscriptionDTO.class).field("client", "person").toClassMap());
       
        Client client = new Client();
        client.setName("Khalil Gebran");
       
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.