Recently, we have started to migrate a spring application to java 8. The application is divided into 3 layers, rest controllers, service and the repository layer. Our 'architect' proposed that our service layer, always accept a mapper function e.g.
public <T> Optional<T> getCompany(int companyId, Mapper<S,T> mapper)
His reason is flexibility - to allow the calling class to format the result in whatever or it wish to.
I do disagree with the the proposal, as i think it's just abuse of the feature. At the same time, i dont want to give the impression that im not willing to adapt new features / concepts if they really bring benefit.
My question is, is the above proposal valid or just an abuse of a java 8 feature?