我正在学习 Play 框架。我对代表仓库-库存商品-产品数据模型的三个类感到困惑:
public class Product {
public Long ean;
public String name;
public String description;
public String toString() {
return name;
}
}
public class Warehouse {
public String name;
public List<StockItem> stock = new ArrayList<>();
public String toString() {
return name;
}
}
public class StockItem {
public Warehouse warehouse;
public Product product;
public Long quantity;
public String toString() {
return String.format("%d %s", quantity, product);
}
}
类Warehouse依赖于类StockItem。类StockItem取决于类Product和Warehouse。
如何理解这种关系?