상품 도메인 개발
상품 도메인 개발
//==비즈니스 로직==//
/**
* stock 증가
* */
public void addStack(int quantity){
this.sotckQuantity += quantity;
}
/**
* stock 감소
* */
public void removeStock(int quantity){
int restStock = this.sotckQuantity - quantity;
if(restStock<0){
throw new NotEnoughStockException("need more stock");
}
this.sotckQuantity = restStock;
}Last updated