网上看了些案例感觉都太全了,新手表示看了反而更头晕了, 就直接厚脸皮来做做伸手党...
假如我的商品和购物车结构如下:
// 商品
{
"id": "1111111"
"title": "这是商品",
"price": 100,
"desc": "xxxxxxx",
"store": [
{"babel": "S", "store": 50},
{"babel": "M", "store": 50},
{"babel": "L", "store": 50}
]
}
// 购物车
{
"id": "userid",
"items": [
{
"title": "这是商品",
"store": [
{"babel": "S", "store": 1},
{"babel": "M", "store": 2}
],
"total_price": 300
]
}
这里的商品里的每一个 store, 购物车里的 items 中的每一个 item, 甚至 item 里的每一个 store, 这些是单独写一个 clsss 还是直接写在商品和购物车类的内部? 尤其是这个 store 两边还通用的情况,,
最后问一下, 假如直接写个 Lsit 会不会被骂.?
public class Cart {
private String title;
private List items;
}
class Item {
private String title;
private List store;
private int total_pric;
}
class Store {
private String label;
private int store;
}