Many equal properties names in this code. Is it possible to make it a lot compact ?
constructor(product) {
this.session = SessionBuilder.create();
this.id = product.id;
this.name = product.name;
this.root = product.root;
this.pics = product.pics;
this.sizes = product.sizes;
this.colors = product.colors;
this.rating = product.rating;
this.feedbacks = product.feedbacks;
}
I found only one solution with getters.
constructor(product) {
this.session = SessionBuilder.create();
this.product = product;
}
get id() {
return this.product.id;
}
get name() {
return this.product.name;
}
...
But i don't really like it. It looks better (for me), but code would be a lot more... Can someone suggest a better solution?