Adjustment Class
- public abstract class Adjustment
extends Object
implements Serializable
Represents an adjustment to a Quote object.
An adjustment must have the same currency for all
money values. Attempts to violate the single currency
rule will produce CurrencyMismatchExceptions.
-
Hierarchy
-
Object
Adjustment
-
All Implemented Interfaces
-
Serializable
-
Direct Known Subclasses
-
LineAdjustment
, OrderAdjustment
protected void |
-
addDetail (AdjustmentDetail aDetail)
- Adding a detail changes the adjustment type to match the detail.
|
protected final boolean |
-
checkCurrency (Money value)
- Compare the currency of the money specified with the
currency of previous money objects in this instance.
|
protected final boolean |
-
checkCurrency (String value)
|
protected final boolean |
-
checkCurrency (AdjustmentDetail detail)
|
protected void |
-
computeAdjustmentAmount ()
- Computes the amount of adjustment.
|
public final Money |
-
getActualPrice ()
- Returns the actual price for this Adjustment.
|
public final Money |
-
getAdjustmentAmount ()
- Returns the amount that this adjustment affects the price
of it's parent.
|
public final Money |
-
getBasePrice ()
- Return the base price for the Adjustment.
|
public final String |
-
getCurrency ()
- Returns the currency for this adjustment.
|
public List |
-
getDetails ()
- Return an unmodifiable list of the AdjustmentDetails for
this Adjustment.
|
public final AdjustmentType |
-
getType ()
- Return the AdjustmentType for this Adjustment
|
protected void |
-
init ()
|
protected final void |
-
markModified ()
- Mark the Adjustment as modified so that the immutable
ImmutableMoney objects returned from getXXXPrice()
can be generated
|
protected void |
-
reset ()
|
protected double |
-
roundBasePrice (double value)
- Provides a means to round the base price amount.
|
public void |
-
set (AdjustmentType aType, Money aBasePrice)
- Set the Adjustment object with the specified values.
|
public void |
-
set (Money aBasePrice)
- Set the Adjustment object with the specified value.
|
protected final void |
-
setActualPrice (Money anActualPrice)
- copy the given Money value into our actualPrice object.
|
protected final void |
-
setAdjustmentAmount (double value)
- Sets the amount of the adjustmentAmount field.
|
protected void |
-
setType (AdjustmentDetail aDetail)
- called by addDetail() to set the type of this adjustment.
|
public String |
-
toString ()
- Provides a string representation of this object.
|
public static String |
-
toString (List adjustments)
- Provides a string representation for a List of Adjustments.
|
details
protected List
details
isSet
protected boolean isSet
type
protected AdjustmentType
type
Adjustment
protected Adjustment()
Adjustment
protected Adjustment(AdjustmentType
aType,
Money
aBasePrice)
Adjustment
protected Adjustment(Money
aBasePrice)
addDetail(AdjustmentDetail) Method
protected void addDetail(AdjustmentDetail
aDetail)
Adding a detail changes the adjustment type to match the detail.
Subclasses can override this behavior by modifying the setType()
method.
checkCurrency(Money) Method
protected final boolean checkCurrency(Money
value)
Compare the currency of the money specified with the
currency of previous money objects in this instance.
Parameters
-
value
- a money object to be compared to the current value
Returns
- true if this is the first money object to be checked or
if the current currency value matches the currency value of the
money specified.
checkCurrency(String) Method
protected final boolean checkCurrency(String
value)
checkCurrency(AdjustmentDetail) Method
protected final boolean checkCurrency(AdjustmentDetail
detail)
computeAdjustmentAmount() Method
protected void computeAdjustmentAmount()
Computes the amount of adjustment. This method may be
overridden by subclasses to provide different computations when
the quantity of items is different from 1.
Adjustment value is positive for an adjustment that lowers
the price of the item, thus a positive value indicates a discount
while a negative value indicates an additional charge.
getActualPrice() Method
public final Money
getActualPrice()
Returns the actual price for this Adjustment.
getAdjustmentAmount() Method
public final Money
getAdjustmentAmount()
Returns the amount that this adjustment affects the price
of it's parent. The computation of this amount may be
modified by subclasses. The default computation of adjustment
amount is base price - actual price.
getBasePrice() Method
public final Money
getBasePrice()
Return the base price for the Adjustment.
getCurrency() Method
public final String
getCurrency()
Returns the currency for this adjustment. All money
values for this adjustment are of this currency
getDetails() Method
public List
getDetails()
Return an unmodifiable list of the AdjustmentDetails for
this Adjustment.
Related Topics
AdjustmentDetail
getType() Method
public final AdjustmentType
getType()
Return the AdjustmentType for this Adjustment
Related Topics
AdjustmentType
init() Method
protected void init()
markModified() Method
protected final void markModified()
Mark the Adjustment as modified so that the immutable
ImmutableMoney objects returned from getXXXPrice()
can be generated
reset() Method
protected void reset()
roundBasePrice(double) Method
protected double roundBasePrice(double value)
Provides a means to round the base price amount.
Subclasses may want different rounding strategies
applied and since basePrice is immutable we
must round it prior to setting it.
The default behavior is not to round the value at
all, subclasses should override as necessary.
Parameters
-
value
- Money amount to be rounded
set(AdjustmentType, Money) Method
public void set(AdjustmentType
aType,
Money
aBasePrice)
Set the Adjustment object with the specified values.
Parameters
-
aType
- the AdjustmentType for this adjustment.
-
aBasePrice
- the base price for the Adjustment.
Related Topics
AdjustmentType
set(Money) Method
public void set(Money
aBasePrice)
Set the Adjustment object with the specified value.
Parameters
-
aBasePrice
- the base price for the Adjustment.
setActualPrice(Money) Method
protected final void setActualPrice(Money
anActualPrice)
copy the given Money value into our actualPrice object.
a call to addDetail() should call this method.
setAdjustmentAmount(double) Method
protected final void setAdjustmentAmount(double value)
Sets the amount of the adjustmentAmount field.
setType(AdjustmentDetail) Method
protected void setType(AdjustmentDetail
aDetail)
called by addDetail() to set the type of this adjustment.
Subclasses may override to get desired behavior.
toString() Method
public String
toString()
Provides a string representation of this object.
This method is intended for debugging and may change at
any time.
-
Overrides
-
Object.toString()
toString(List) Method
public static String
toString(List
adjustments)
Provides a string representation for a List of Adjustments.
This method is intended for debugging and may change at
any time.