Skip to content

A helper project to access Mapstruct created mapper s with source and target types.

Notifications You must be signed in to change notification settings

sinanyumak/generic-mapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Generic Mapper

A helper project to access Mapstruct created mapper s with source and target types.

Usage

  • Create model and dto objects.
public class Fruit {
}

public class FruitDto {
}
  • Create a Mapstruct mapper which extends GenericMapper interface.
@Mapper( componentModel="spring" )
public interface FruitMapper extends GenericMapper<Fruit, FruitDto> {
}
  • Inject GenericMapperService to your service and lookup for the mapper.
@Autowired
private GenericMapperService mapperService;

GenericMapper<Fruit, FruitDto> mapper = mapperService.getMapper( Fruit.class, FruitDto.class );
  • You can also inject your GenericMapper to your services directly with Spring's injection capabilities.
@Autowired
GenericMapper<Fruit, FruitDto> fruitMapper;

About

A helper project to access Mapstruct created mapper s with source and target types.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages