Skip to content

Instantly share code, notes, and snippets.

@Tonel
Last active March 10, 2021 20:08
Show Gist options
  • Save Tonel/3125eac131e0fe0ed2aa28c9e8390255 to your computer and use it in GitHub Desktop.
Save Tonel/3125eac131e0fe0ed2aa28c9e8390255 to your computer and use it in GitHub Desktop.
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2020-06-28T09:24:47+0200",
comments = "version: 1.3.1.Final, compiler: javac, environment: Java 13.0.2 (Oracle Corporation)"
)
@Component
public class AuthorMapperImpl implements AuthorMapper {
@Override
public AuthorDto authorToAuthorDto(Author author) {
if ( author == null ) {
return null;
}
AuthorDto authorDto = new AuthorDto();
authorDto.setId( author.getId() );
authorDto.setName( author.getName() );
authorDto.setSurname( author.getSurname() );
authorDto.setBirthDate( author.getBirthDate() );
authorDto.setBooks( bookListToBookDtoList( author.getBooks() ) );
return authorDto;
}
@Override
public List<AuthorDto> authorsToAuthorDtos(List<Author> authors) {
if ( authors == null ) {
return null;
}
List<AuthorDto> list = new ArrayList<AuthorDto>( authors.size() );
for ( Author author : authors ) {
list.add( authorToAuthorDto( author ) );
}
return list;
}
protected BookDto bookToBookDto(Book book) {
if ( book == null ) {
return null;
}
BookDto bookDto = new BookDto();
bookDto.setId( book.getId() );
bookDto.setTitle( book.getTitle() );
bookDto.setReleaseDate( book.getReleaseDate() );
return bookDto;
}
protected List<BookDto> bookListToBookDtoList(List<Book> list) {
if ( list == null ) {
return null;
}
List<BookDto> list1 = new ArrayList<BookDto>( list.size() );
for ( Book book : list ) {
list1.add( bookToBookDto( book ) );
}
return list1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment