Merge pull request #748 from pelmegov/clean-converter-class

Parameters in Converter class methods was renamed.
This commit is contained in:
Ilkka Seppälä 2018-04-29 10:39:51 +03:00 committed by GitHub
commit 4ac6f90c96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,37 +50,37 @@ public class Converter<T, U> {
} }
/** /**
* @param userDto DTO entity * @param dto DTO entity
* @return The domain representation - the result of the converting function application on dto entity. * @return The domain representation - the result of the converting function application on dto entity.
*/ */
public final U convertFromDto(final T userDto) { public final U convertFromDto(final T dto) {
return fromDto.apply(userDto); return fromDto.apply(dto);
} }
/** /**
* @param user domain entity * @param entity domain entity
* @return The DTO representation - the result of the converting function application on domain entity. * @return The DTO representation - the result of the converting function application on domain entity.
*/ */
public final T convertFromEntity(final U user) { public final T convertFromEntity(final U entity) {
return fromEntity.apply(user); return fromEntity.apply(entity);
} }
/** /**
* @param dtoUsers collection of DTO entities * @param dtos collection of DTO entities
* @return List of domain representation of provided entities retrieved by * @return List of domain representation of provided entities retrieved by
* mapping each of them with the conversion function * mapping each of them with the conversion function
*/ */
public final List<U> createFromDtos(final Collection<T> dtoUsers) { public final List<U> createFromDtos(final Collection<T> dtos) {
return dtoUsers.stream().map(this::convertFromDto).collect(Collectors.toList()); return dtos.stream().map(this::convertFromDto).collect(Collectors.toList());
} }
/** /**
* @param users collection of domain entities * @param entities collection of domain entities
* @return List of domain representation of provided entities retrieved by * @return List of domain representation of provided entities retrieved by
* mapping each of them with the conversion function * mapping each of them with the conversion function
*/ */
public final List<T> createFromEntities(final Collection<U> users) { public final List<T> createFromEntities(final Collection<U> entities) {
return users.stream().map(this::convertFromEntity).collect(Collectors.toList()); return entities.stream().map(this::convertFromEntity).collect(Collectors.toList());
} }
} }