Search in sources :

Example 1 with MapperFacade

use of ma.glasnost.orika.MapperFacade in project useful-java-links by Vedenin.

the class OrikaHelloWorld method main.

public static void main(String[] args) {
    // init mapper
    MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
    mapperFactory.classMap(Source.class, Destination.class).field("message", "text").register();
    MapperFacade mapper = mapperFactory.getMapperFacade();
    // convert
    Source source = new Source("Hello World!");
    Destination destObject = mapper.map(source, Destination.class);
    // print Hello World!
    destObject.print();
}
Also used : MapperFacade(ma.glasnost.orika.MapperFacade) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory) MapperFactory(ma.glasnost.orika.MapperFactory) DefaultMapperFactory(ma.glasnost.orika.impl.DefaultMapperFactory)

Example 2 with MapperFacade

use of ma.glasnost.orika.MapperFacade in project orika-spring-boot-starter by akihyro.

the class OrikaAutoConfiguration method orikaMapperFacade.

/**
     * Creates a {@link MapperFacade}.
     *
     * @param orikaMapperFactory the {@link MapperFactory}.
     * @return a {@link MapperFacade}.
     */
@ConditionalOnMissingBean
@Bean
public MapperFacade orikaMapperFacade(MapperFactory orikaMapperFactory) {
    MapperFacade orikaMapperFacade = orikaMapperFactory.getMapperFacade();
    log.debug("Created a MapperFacade: [{}]", orikaMapperFacade);
    return orikaMapperFacade;
}
Also used : MapperFacade(ma.glasnost.orika.MapperFacade) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

MapperFacade (ma.glasnost.orika.MapperFacade)2 MapperFactory (ma.glasnost.orika.MapperFactory)1 DefaultMapperFactory (ma.glasnost.orika.impl.DefaultMapperFactory)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1