SalesPoint Framework v3.1

data.ooimpl
Class StockItemImpl

java.lang.Object
  extended bydata.AbstractNameable
      extended bydata.ooimpl.StockItemImpl
All Implemented Interfaces:
Cloneable, Comparable, DataBasketKeys, Nameable, Serializable, StockItem
Direct Known Subclasses:
StockImpl

public class StockItemImpl
extends AbstractNameable
implements StockItem, DataBasketKeys

Pure Java implementation of the StockItem interface. See the documentation for StockItem for a description of the semantics of this class.

Since:
v2.0
Author:
Steffen Zschaler
See Also:
Serialized Form

Field Summary
 
Fields inherited from class data.AbstractNameable
m_ncContext, m_pcsPropertyListeners
 
Fields inherited from interface data.Nameable
NAME_PROPERTY
 
Fields inherited from interface data.DataBasketKeys
CATALOG_ITEM_MAIN_KEY, STOCK_ITEM_MAIN_KEY
 
Constructor Summary
StockItemImpl(String sName)
          Create a new StockItemImpl.
 
Method Summary
 Object clone()
          Clone this StockItem.
 int compareTo(Object o)
          Compare this StockItem to the given object.
 boolean equals(Object o)
          Check whether this StockItem equals the given object.
 CatalogItem getAssociatedItem(DataBasket db)
          Get the CatalogItem that is associated with this StockItem.
 StockItemImpl getShallowClone()
          Get a shallow clone of this item.
 Stock getStock()
          Get the Stock that contains this StockItem.
protected  void setStock(StockImpl sti)
          Set the Stock that contains this StockItem.
 String toString()
          Return a String representation of the item.
 
Methods inherited from class data.AbstractNameable
addNameListener, addPropertyChangeListener, attach, detachNC, getName, removeNameListener, removePropertyChangeListener, setName
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface data.Nameable
addNameListener, addPropertyChangeListener, attach, detachNC, getName, removeNameListener, removePropertyChangeListener, setName
 

Constructor Detail

StockItemImpl

public StockItemImpl(String sName)
Create a new StockItemImpl.

Parameters:
sName - the name of the new item.
Method Detail

getStock

public Stock getStock()
Get the Stock that contains this StockItem.

Specified by:
getStock in interface StockItem
Override:
Never

getAssociatedItem

public CatalogItem getAssociatedItem(DataBasket db)
Get the CatalogItem that is associated with this StockItem.

If the StockItem has a Stock, the associated CatalogItem is the CatalogItem of the same name that is found in the Stock's associated Catalog. Otherwise, it is null.

Specified by:
getAssociatedItem in interface StockItem
Parameters:
db - the DataBasket used to determine visibility.
Override:
Never

setStock

protected void setStock(StockImpl sti)
Set the Stock that contains this StockItem.

Override:
Never

clone

public Object clone()
Clone this StockItem.

Specified by:
clone in interface StockItem
Override:
Always

getShallowClone

public StockItemImpl getShallowClone()
Get a shallow clone of this item.

For a normal item, shallow and deep clones are identical, which is why the default implementation returns ((StockItemImpl) clone()). However, when making a shallow clone of a Stock, the individual StockItems will not be cloned.

Override:
Sometimes The default implementation returns (StockItemImpl) clone().

equals

public boolean equals(Object o)
Check whether this StockItem equals the given object.

Override:
Sometimes The default implementation returns (this == o).

compareTo

public int compareTo(Object o)
Compare this StockItem to the given object.

Specified by:
compareTo in interface Comparable
Throws:
ClassCastException - if the given object cannot be converted into a StockItem.
Override:
Sometimes The default implementation will assume o to be a StockItem and will compare the names. Stocks, however, will always be greater than StockItems.

toString

public String toString()
Return a String representation of the item.

Override:
Sometimes

SalesPoint Framework v3.1