© 2005 BEA Systems, Inc.

com.beasys.commerce.axiom.units
Class UnitPriceImpl

java.lang.Object
  extended bycom.beasys.commerce.foundation.BelongingImpl
      extended bycom.beasys.commerce.axiom.units.UnitPriceImpl
All Implemented Interfaces:
Belonging, BusinessSmartComponent, Cloneable, Comparable, RelationalReference, Serializable, UnitPrice

public class UnitPriceImpl
extends BelongingImpl
implements UnitPrice, Cloneable

Combines a unit and a price to provide a mechanism for recording pricing and pricing strategies. It also provides features for converting prices between units.

See Also:
UnitPrice, UnitPriceHome, Serialized Form

Field Summary
 Price price
          The price component of the UnitPrice.
 Unit unit
          The unit component of the UnitPrice.
 
Fields inherited from class com.beasys.commerce.foundation.BelongingImpl
__classIdentifier, __containingBelonging, __containingEntity, __mapKey, __sequenceNumber, _isDirty
 
Constructor Summary
UnitPriceImpl()
           
 
Method Summary
 int compareTo(Object o)
          Compare this belonging to another
 UnitPrice convert(Unit newUnit)
          Return a new UnitPrice that maintains the Price/Unit ratio with the newly specified unit.
 void convertInPlace(Unit newUnit)
          Translate the UnitPrice into the new Units maintaining the Price/Unit ratio.
 Price getPrice()
          Get the value of price
 Unit getUnit()
          Get the value of unit
 String interfaceName()
          interfaceName() returns the unqualified name of the interface from the UML model
 void setByValue(Belonging value)
          It is possible to call set-by-value with a superclass.
 void setPrice(Price price)
          Set the value of price
 void setUnit(Unit unit)
          Set the value of unit
 Belonging value()
          value() is a more typesafe implementation of clone()
 
Methods inherited from class com.beasys.commerce.foundation.BelongingImpl
clearRelationalBinding, clearRelationalBinding, clearRelationalBinding, clearRelationalBinding, clone, doRelationalBinding, doRelationalBinding, doRelationalBindingOnElement, doRelationalBindingOnElement, doRelationalBindingOnElement, doRelationalBindingOnSingleton, doRelationalBindingOnSingleton, doRelationalBindingOnSingleton, doRelationalBindingWithMapKey, doRelationalBindingWithMapKey, doRelationalBindingWithMapKey, enumerateRelationalBinding, enumerateRelationalBinding, equals, get__classIdentifier, get__containingBelonging, get__containingEntity, get__containingEntityReference, get__mapKey, get__sequenceNumber, getPersistenceHelperPlugin, hashCode, set__classIdentifier, set__containingBelonging, set__containingEntity, set__containingEntityReference, set__mapKey, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.beasys.commerce.foundation.Belonging
clone, equals
 

Field Detail

price

public Price price
The price component of the UnitPrice.


unit

public Unit unit
The unit component of the UnitPrice.

Constructor Detail

UnitPriceImpl

public UnitPriceImpl()
Method Detail

compareTo

public int compareTo(Object o)
Compare this belonging to another

Specified by:
compareTo in interface Comparable
Specified by:
compareTo in class BelongingImpl
Parameters:
o - target object for comparision
Returns:
0 objects are equal

convert

public UnitPrice convert(Unit newUnit)
                  throws InvalidUnitException
Return a new UnitPrice that maintains the Price/Unit ratio with the newly specified unit.

Specified by:
convert in interface UnitPrice
Throws:
InvalidUnitException

convertInPlace

public void convertInPlace(Unit newUnit)
                    throws InvalidUnitException
Translate the UnitPrice into the new Units maintaining the Price/Unit ratio.

Specified by:
convertInPlace in interface UnitPrice
Throws:
InvalidUnitException

getPrice

public Price getPrice()
Get the value of price

Specified by:
getPrice in interface UnitPrice
Returns:
price.

getUnit

public Unit getUnit()
Get the value of unit

Specified by:
getUnit in interface UnitPrice
Returns:
unit.

interfaceName

public String interfaceName()
interfaceName() returns the unqualified name of the interface from the UML model

Specified by:
interfaceName in interface Belonging
Returns:
the unqualified name of the belonging interface from the UML model

setByValue

public void setByValue(Belonging value)
It is possible to call set-by-value with a superclass. If that is the case, only the fields in the superclass will be set in this instance. The remaining fields get the default values.

It is also possible to call set-by-value with a subclass. In this case, the specialized fields in the subclass will be ignored. The overridden fields in the subclass will be populated.

Specified by:
setByValue in interface Belonging
Overrides:
setByValue in class BelongingImpl
Parameters:
value - The Belonging to use for initialization.

setPrice

public void setPrice(Price price)
Set the value of price

Specified by:
setPrice in interface UnitPrice
Parameters:
price - price to be added

setUnit

public void setUnit(Unit unit)
Set the value of unit

Specified by:
setUnit in interface UnitPrice
Parameters:
unit - unit to be added

value

public Belonging value()
value() is a more typesafe implementation of clone()

Specified by:
value in interface Belonging
Returns:
a clone of this instance

© 2005 BEA Systems, Inc.

Copyright © 2005 BEA Systems, Inc. All Rights Reserved