Code example for ObjectRetrievalFailureException

0
	} 
 
	public Restaurant findByMerchantNumber(String merchantNumber) { 
		Restaurant restaurant = (Restaurant) restaurantsByMerchantNumber.get(merchantNumber); 
		if (restaurant == null) { 
			throw new ObjectRetrievalFailureException(Restaurant.class, merchantNumber); 
		} 
		return restaurant; 
	} 
 
	/** 
	 * A simple "dummy" benefit availability policy that always returns true. Only useful for testing--a real 
	 * availability policy might consider many factors such as the day of week of the dining, or the account's reward 
	 * history for the current month. 
	 */ 
	private static class AlwaysReturnsTrue implements BenefitAvailabilityPolicy { 
		public boolean isBenefitAvailableFor(Account account, Dining dining) { 
			return true; 
		} 
	}