# com.beasys.commerce.ebusiness.shoppingcart
ShoppingCartLineImpl Class

public class ShoppingCartLineImpl
extends `BelongingImpl`
implements `ShoppingCartLine`

This class combines an Item, a Quantity and a Money. The item is a reference to an entity bean.

Related Topics

``ShoppingCartLine``
``ShoppingCartLineHome``

Hierarchy
  `Object`
  `BelongingImpl`
  `ShoppingCartLineImpl`

All Implemented Interfaces
  `Belonging`, `BusinessSmartComponent`, `Cloneable`, `Comparable`, `RelationalReference`, `Serializable`, `ShoppingCartLine`

## Field Summary

`public `ProductItem`` | `productItem` Containment: By Value Multiplicity: 1:1
`public double` | `quantity` Containment: By Value Multiplicity: 1:1
`public `Money`` | `shipping` Containment: By Value Multiplicity: 1:1
`public `Money`` | `tax` Containment: By Value Multiplicity: 1:1
`public `Money`` | `unitPrice` Containment: By Value Multiplicity: 1:1

Fields from com.beasys.commerce.foundation`.`BelongingImpl``
``__classIdentifier`, `__containingBelonging`, `__containingEntity`, `__mapKey`, `__sequenceNumber`, `_isDirty``

## Constructor Summary

ShoppingCartLineImpl()

## Method Summary

`public int` | `compareTo`(`Object` o) Compare this belonging to another
`public `Money`` | `getBaseSavings`() Get the savings from the MSRP to the base unit price, exluding non-catalog discounts, i.e. quantity * (MSRP - Unit Price)
`public `Money`` | `getBaseTotal`() Get the total excluing non-catalog discounts, i.e.
`public `Money`` | `getDiscountedPrice`() get the Discounted Price for the line
`public `ArrayList`` | `getDiscountPresentations`() get the Discount Description Array list of the discounts that apply to a particular shopping cart line
`public `Money`` | `getLineTotal`(int totalType) Gets the line total for the given total type
`public `ProductItem`` | `getProductItem`() Get the value of productItem
`public double` | `getQuantity`() Get the value of quantity
`public `Money`` | `getSavings`() Get the value of the savings made on this line.
`public `Money`` | `getShipping`() Get the value of shipping
`public `Money`` | `getTax`() Get the value of tax
`public `Money`` | `getUnitPrice`() Get the value of unitPrice
`public `String`` | `interfaceName`() interfaceName() returns the unqualified name of the interface from the UML model
`public void` | `setByValue`(`Belonging` value) It is possible to call set-by-value with a superclass.
`public void` | `setDiscountedPrice`(`Money` discountedPrice) Set the discount price for this line
`public void` | `setDiscountPresentations`(`ArrayList` discountPresentations) Set the value of discount Presentations of the discounts that apply to a particular shopping cart line
`public void` | `setProductItem`(`ProductItem` productItem) Set the value of productItem
`public void` | `setQuantity`(double quantity) Set the value of quantity
`public void` | `setShipping`(`Money` shipping) Set the value of shipping
`public void` | `setTax`(`Money` tax) Set the value of tax
`public void` | `setUnitPrice`(`Money` unitPrice) Set the value of unitPrice
`public `Belonging`` | `value`() value() is a more typesafe implementation of clone()

Methods from `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 from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `com.beasys.commerce.foundation.`Belonging``
``clone`, `equals`, `interfaceName`, `setByValue`, `value``

Methods from interface `java.lang.`Comparable``
`compareTo`

Methods from interface `com.beasys.commerce.foundation.`RelationalReference``
``get__classIdentifier`, `get__containingBelonging`, `get__containingEntity`, `get__mapKey`, `get__sequenceNumber`, `set__containingBelonging`, `set__containingEntity`, `set__mapKey``

Methods from interface `com.beasys.commerce.ebusiness.shoppingcart.`ShoppingCartLine``
``getBaseSavings`, `getBaseTotal`, `getDiscountedPrice`, `getDiscountPresentations`, `getLineTotal`, `getProductItem`, `getQuantity`, `getSavings`, `getShipping`, `getTax`, `getUnitPrice`, `setDiscountedPrice`, `setDiscountPresentations`, `setProductItem`, `setQuantity`, `setShipping`, `setTax`, `setUnitPrice``

## Field Detail

### productItem

    public ProductItem productItem

  - Containment: By Value
  - Multiplicity: 1:1

### quantity

    public double quantity

  - Containment: By Value
  - Multiplicity: 1:1

### shipping

    public Money shipping

  - Containment: By Value
  - Multiplicity: 1:1

### tax

    public Money tax

  - Containment: By Value
  - Multiplicity: 1:1

### unitPrice

    public Money unitPrice

  - Containment: By Value
  - Multiplicity: 1:1

## Constructor Detail

### ShoppingCartLineImpl

    public ShoppingCartLineImpl()

## Method Detail

### compareTo(Object) Method

    public int compareTo(Object o)

Compare this belonging to another

Overrides
  `BelongingImpl.compareTo(Object)`

#### Parameters

o
  target object for comparision

#### Returns

0 objects are equal

### getBaseSavings() Method

    public Money getBaseSavings()

Get the savings from the MSRP to the base unit price, exluding non-catalog discounts, i.e. quantity * (MSRP - Unit Price)

#### Returns

base savings

### getBaseTotal() Method

    public Money getBaseTotal()

Get the total excluing non-catalog discounts, i.e. the quantity * unit price for this line

#### Returns

baseTotal

### getDiscountedPrice() Method

    public Money getDiscountedPrice()

get the Discounted Price for the line

#### Returns

the price as discounted

### getDiscountPresentations() Method

    public ArrayList getDiscountPresentations()

get the Discount Description Array list of the discounts that apply to a particular shopping cart line

#### Returns

an ArrayList of DiscountDescription objects

### getLineTotal(int) Method

    public Money getLineTotal(int totalType)
         throws InvalidArgumentException

Gets the line total for the given total type

#### Parameters

totalType
  type

#### Exceptions

``InvalidArgumentException``

### getProductItem() Method

    public ProductItem getProductItem()

Get the value of productItem

#### Returns

productItem.

### getQuantity() Method

    public double getQuantity()

Get the value of quantity

#### Returns

quantity.

### getSavings() Method

    public Money getSavings()

Get the value of the savings made on this line. Calulates the difference between the Msrp and the unit price and multiplies it by the line quantity

#### Returns

savings.

### getShipping() Method

    public Money getShipping()

Get the value of shipping

#### Returns

shipping.

### getTax() Method

    public Money getTax()

Get the value of tax

#### Returns

tax.

### getUnitPrice() Method

    public Money getUnitPrice()

Get the value of unitPrice

#### Returns

unitPrice.

### interfaceName() Method

    public String interfaceName()

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

#### Returns

the unqualified name of the belonging interface from the UML model

### setByValue(Belonging) Method

    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.

Overrides
  `BelongingImpl.setByValue(Belonging)`

#### Parameters

value
  The `Belonging` to use for initialization.

### setDiscountedPrice(Money) Method

    public void setDiscountedPrice(Money discountedPrice)

Set the discount price for this line

#### Parameters

discountedPrice
  the price as discounted

### setDiscountPresentations(ArrayList) Method

    public void setDiscountPresentations(ArrayList discountPresentations)

Set the value of discount Presentations of the discounts that apply to a particular shopping cart line

#### Parameters

discountPresentations
  an ArrayList of DiscountDescription objects

### setProductItem(ProductItem) Method

    public void setProductItem(ProductItem productItem)

Set the value of productItem

#### Parameters

productItem
  productItem to be added

### setQuantity(double) Method

    public void setQuantity(double quantity)

Set the value of quantity

#### Parameters

quantity
  quantity to be added

### setShipping(Money) Method

    public void setShipping(Money shipping)

Set the value of shipping

#### Parameters

shipping
  shipping to be added

### setTax(Money) Method

    public void setTax(Money tax)

Set the value of tax

#### Parameters

tax
  tax to be added

### setUnitPrice(Money) Method

    public void setUnitPrice(Money unitPrice)

Set the value of unitPrice

#### Parameters

unitPrice
  unitPrice to be set

### value() Method

    public Belonging value()

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

#### Returns

a clone of this instance