@@ -0,0 +1,1740 @@
+package org.example.seed.mapper.jpa;%0A%0Aimport org.springframework.scheduling.annotation.AsyncResult;%0A%0Aimport java.io.Serializable;%0Aimport java.util.List;%0Aimport java.util.Optional;%0Aimport java.util.concurrent.Future;%0Aimport java.util.stream.Collectors;%0Aimport java.util.stream.Stream;%0A%0A/**%0A * Created by PINA on 26/06/2017.%0A */%0Apublic interface GenericMapper%3CF, T extends Serializable%3E %7B%0A%0A    T map(final F from);%0A%0A    F map(final T from);%0A%0A    default Future%3CF%3E map(final Future%3CT%3E from) %7B%0A        return Optional.of(from).map(f -%3E %7B%0A            try %7B%0A                return new AsyncResult%3C%3E(this.map(f.get()));%0A            %7D catch (final Exception e) %7B%0A                throw new RuntimeException(e);%0A            %7D%0A        %7D).orElse(null);%0A    %7D%0A%0A    default List%3CT%3E mapList(final List%3CF%3E from) %7B%0A        return Optional.of(from).orElse(null).stream().map(this::map).collect(Collectors.toList());%0A    %7D%0A%0A    default Future%3CList%3CT%3E%3E mapList(final Future%3CList%3CF%3E%3E from) %7B%0A        return Optional.of(from).map(f -%3E %7B%0A            try %7B%0A                return new AsyncResult%3C%3E(this.mapList(f.get()));%0A            %7D catch (final Exception e) %7B%0A                throw new RuntimeException(e);%0A            %7D%0A        %7D).orElse(null);%0A    %7D%0A%0A    default List%3CF%3E mapListReverse(final List%3CT%3E from) %7B%0A        return Optional.of(from).orElse(null).stream().map(this::map).collect(Collectors.toList());%0A    %7D%0A%0A    default Future%3CList%3CF%3E%3E mapListReverse(final Future%3CList%3CT%3E%3E from) %7B%0A        return Optional.of(from).map(f -%3E %7B%0A            try %7B%0A                return new AsyncResult%3C%3E(this.mapListReverse(f.get()));%0A            %7D catch (final Exception e) %7B%0A                throw new RuntimeException(e);%0A            %7D%0A        %7D).orElse(null);%0A    %7D%0A%7D%0A

create Mapper pattern using Map Struct approach