mercredi 18 mars 2020

when to implement java 8 functions and when to not?

This question is more like a design dilemma.
As we all know, in java 8, if we implement a function, we can expect it to take argument of one type and return another specified object type in function definition.
So, Instead of writing DAO class(which will do the jdbc call and get/update the record), I decided to go ahead with function which will take jdbc template and return the result model object.

public class Extractor implements Function<JdbcTemplate, ResultModel> 

Is this approach correct? What principles I am possibly violating here?

Aucun commentaire:

Enregistrer un commentaire