Parameters in Converter class methods was renamed. A base class must not contain the concrete entities names or concrete class names

This commit is contained in:
pelmegov 2018-04-28 19:34:57 +03:00
parent 998600f09e
commit a8d89ca861

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());
} }
} }