2929import java .util .stream .Collectors ;
3030
3131/**
32+ * Generic converter, thanks to Java8 features not only provides a way of generic bidirectional
33+ * conversion between coresponding types, but also a common way of converting a collection of objects
34+ * of the same type, reducing boilerplate code to the absolute minimum.
3235 * @param <T> DTO representation's type
3336 * @param <U> Domain representation's type
3437 */
@@ -47,37 +50,37 @@ public Converter(final Function<T, U> fromDto, final Function<U, T> fromEntity)
4750 }
4851
4952 /**
50- * @param arg DTO entity
53+ * @param userDto DTO entity
5154 * @return The domain representation - the result of the converting function application on dto entity.
5255 */
53- public U convertFromDto (final T arg ) {
54- return fromDto .apply (arg );
56+ public final U convertFromDto (final T userDto ) {
57+ return fromDto .apply (userDto );
5558 }
5659
5760 /**
58- * @param arg domain entity
61+ * @param user domain entity
5962 * @return The DTO representation - the result of the converting function application on domain entity.
6063 */
61- public T convertFromEntity (final U arg ) {
62- return fromEntity .apply (arg );
64+ public final T convertFromEntity (final U user ) {
65+ return fromEntity .apply (user );
6366 }
6467
6568 /**
66- * @param arg collection of DTO entities
69+ * @param dtoUsers collection of DTO entities
6770 * @return List of domain representation of provided entities retrieved by
6871 * mapping each of them with the convertion function
6972 */
70- public List <U > createFromDtos (final Collection <T > arg ) {
71- return arg .stream ().map (this ::convertFromDto ).collect (Collectors .toList ());
73+ public final List <U > createFromDtos (final Collection <T > dtoUsers ) {
74+ return dtoUsers .stream ().map (this ::convertFromDto ).collect (Collectors .toList ());
7275 }
7376
7477 /**
75- * @param arg collection of domain entities
78+ * @param users collection of domain entities
7679 * @return List of domain representation of provided entities retrieved by
7780 * mapping each of them with the convertion function
7881 */
79- public List <T > createFromEntities (final Collection <U > arg ) {
80- return arg .stream ().map (this ::convertFromEntity ).collect (Collectors .toList ());
82+ public final List <T > createFromEntities (final Collection <U > users ) {
83+ return users .stream ().map (this ::convertFromEntity ).collect (Collectors .toList ());
8184 }
8285
8386}
0 commit comments