examples.businesspolicy
Class AprilFoolsDiscountPolicy
java.lang.Object
|
+--examples.businesspolicy.AprilFoolsDiscountPolicy
- public class AprilFoolsDiscountPolicy
- extends java.lang.Object
- implements ItemPriceCalculationPolicy, java.io.Serializable
This class is a custom item pricing calculation policy.
When applied to an item's price, the price is discounted by
APRIL_DISCOUNT_RATE but the limit for this pricing is QUANTITY_LIMIT.
If the request for price is under QUANTITY_LIMIT no discount will be
applied.
This policy takes into account the quantity of items being
priced.
- See Also:
Item
,
ItemPriceCalculationPolicy
,
BusinessPolicy
,
AprilFoolsDiscountPolicy
,
Quantity
,
Price
, Serialized Form
Method Summary |
Price |
calculatePrice(Item item,
Quantity qty,
Customer customer)
1.- The price is obtained from the item (It could be obtained
from an alternate DB)
2.- If the quantity is smaller than QUANTITY_LIMIT return price
2.- The price is discounted by APRIL DISCOUNT RATE
3.- The price is returned |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
QUANTITY_LIMIT
public static final int QUANTITY_LIMIT
APRIL_DISCOUNT_RATE
public static final double APRIL_DISCOUNT_RATE
AprilFoolsDiscountPolicy
public AprilFoolsDiscountPolicy()
calculatePrice
public Price calculatePrice(Item item,
Quantity qty,
Customer customer)
throws java.rmi.RemoteException
- 1.- The price is obtained from the item (It could be obtained
from an alternate DB)
2.- If the quantity is smaller than QUANTITY_LIMIT return price
2.- The price is discounted by APRIL DISCOUNT RATE
3.- The price is returned
- Specified by:
- calculatePrice in interface ItemPriceCalculationPolicy
- Parameters:
item
- The item being pricedqty
- The quantity being priced- Throws:
- java.rmi.RemoteException -
Copyright © 2000 BEA Systems, Inc. All Rights Reserved