示例#1
0
 public void delete(Beer beer) {
   logger.debug("Deleting beer: " + beer.toString());
   if (beerMap.containsKey(beer.getId())) {
     beerMap.remove(beer.getId());
   } else {
     throw new BeerNotFoundException(
         beer.getId(), "No beer with id = " + beer.getId() + " exists");
   }
 }
示例#2
0
 public Beer update(Beer beer) {
   logger.debug("Updating beer: " + beer.toString());
   if (beerMap.containsKey(beer.getId())) {
     beerMap.put(beer.getId(), beer);
   } else {
     throw new BeerNotFoundException(
         beer.getId(), "No beer with id = " + beer.getId() + " exists");
   }
   return beer;
 }
示例#3
0
 public Beer create(Beer beer) {
   beer.setId(idSeq.getAndIncrement());
   logger.debug("Creating beer: " + beer.toString());
   beerMap.put(beer.getId(), beer);
   return beerMap.get(beer.getId());
 }