mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2024-11-16 21:33:21 +00:00
Module Core, clss Product : Ajout constructeur de copie + modif méthode de copie du contenu (utilisation des streams)
This commit is contained in:
parent
79d531273a
commit
0b8bb4e183
@ -33,10 +33,14 @@ public class Product implements ILoggable, Serializable{
|
|||||||
this.category = category;
|
this.category = category;
|
||||||
this.components = new ArrayList<>();
|
this.components = new ArrayList<>();
|
||||||
if(components!=null){
|
if(components!=null){
|
||||||
this.components.addAll(components);
|
components.stream().forEach(p->this.components.add(new Product(p)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Product(Product p) {
|
||||||
|
this(p.id, p.name, p.amountRemaining, p.amountSold, p.sellable, p.price, p.components, p.category);
|
||||||
|
}
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user