h2020-westlife-eu / wp6-repository

https://h2020-westlife-eu.github.io/wp6-repository/
MIT License
0 stars 0 forks source link

backend code review - model.DataSet model.Project and model.* #20

Closed TomasKulhanek closed 6 years ago

TomasKulhanek commented 6 years ago

There is repeating pattern of private field and getter setter methods. Is there good reason to have this pattern everywhere? I think DataSet and Project are mainly DTO objects reflecting the database items.

class DataSet{ private xx public getXX() {return xx} public setXX(_xx) { xx=_xx} }

Does it make sense to have just POJO class with public field, E.g. field id, name, ...:

class DataSet{ public final Long id; public final String name; }

andreagia commented 6 years ago

I completely agree and it was my mistake

Andrea

On 13 Feb 2018, at 09:29, Tomas Kulhanek notifications@github.com wrote:

There is repeating pattern of private field and getter setter methods. Is there good reason to have this pattern everywhere? I think DataSet and Project are mainly DTO objects reflecting the database items.

class DataSet{ private xx public getXX() {return xx} public setXX(_xx) { xx=_xx} }

Does it make sense to have just POJO class with public field, E.g. field id, name, ...:

class DataSet{ public final Long id; public final String name; }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/h2020-westlife-eu/wp6-repository/issues/20, or mute the thread https://github.com/notifications/unsubscribe-auth/AMaWicomflR-VeQWYN2Z3eHt6q-R2gf-ks5tUUf0gaJpZM4SDYJN.

andreagia commented 6 years ago

Hi Tomas I have read well your comment now, the DataSet class are used as entity for JPA/hibernate

TomasKulhanek commented 6 years ago

OK. As I understand the Java frameworks, they depend heavily in order to access object fields using reflection. Then leave them as they are - but generating JSON from this objects fails as there is nested fields and other staff which violates POJO. Is there some clean way to generate JSON?