Skip to content

sheiy/orika-spring-boot-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Example

@Component
public class TestOrikaMapper implements OrikaMapper {
    @Override
    public void register(MapperFactory mapperFactory) {
        mapperFactory.classMap(X.class, Y.class)
                .field("x", "y")
                .byDefault().register();
    }
}

@RestController
public class TController {
    @Resource
    private MapperFacade facade;
    @GetMapping("/test")
    public Y test() {
        X x = new X();
        x.setX("X");
        x.setCommon("common");
        return facade.map(x, Y.class);
    }
}

via '/test' you will see

{
"common": "common",
"y": "X"
}

custom mapperFactory

@Configuration
public class Config {
    @Bean
    public MapperFactory mapperFactory() {
        //init your own factory here
        return new DefaultMapperFactory.Builder().build();
    }
}

more info of orika click here

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages