DJDoc v.1.0.0b-1

net.sf.djdoc.bo
Class ItemVO

java.lang.Object
  extended by net.sf.djdoc.bo.ItemVO
All Implemented Interfaces:
java.lang.Comparable, Hittable, Item
Direct Known Subclasses:
ItemEntity

public class ItemVO
extends java.lang.Object
implements Item

The class ItemVO is a concrete implementation of the Item interface. It implements the Value Object design pattern.


Nested Class Summary
 
Nested classes/interfaces inherited from interface net.sf.djdoc.bo.Item
Item.ItemType
 
Field Summary
 
Fields inherited from interface net.sf.djdoc.bo.Hittable
FAVORITE, NATURAL, RECENT
 
Constructor Summary
protected ItemVO()
          Protected no-argument constructor; overridden by the ItemEntity class.
  ItemVO(Item that)
          Public copy constructor.
 
Method Summary
 int compareTo(java.lang.Object obj)
          Comparison method for two ItemVOs.
 int getHitCount()
          Getter method for this ItemVO's hit count.
 java.util.Date getHitDate()
          Getter method for this ItemVO's hit date.
 java.lang.String getName()
          Getter method for this ItemVO's name.
 Item.ItemType getType()
          Getter method for this ItemVO's item type.
 void hit()
          This method marks this ItemVO as hit.
 void setHitCount(int hitCount)
          Setter method for this ItemVO's hit count.
 void setHitDate(java.util.Date hitDate)
          Setter method for this ItemVO's hit date.
 void setName(java.lang.String name)
          Setter method for this ItemVO's name.
 void setType(Item.ItemType type)
          Setter method for this ItemVO's item type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItemVO

public ItemVO(Item that)
Public copy constructor.

Parameters:
that - The Item instance whose attribute values are to be copied to this ItemVO object.

ItemVO

protected ItemVO()
Protected no-argument constructor; overridden by the ItemEntity class.

Method Detail

getName

public java.lang.String getName()
Getter method for this ItemVO's name.

Specified by:
getName in interface Item
Returns:
The name of this ItemVO

setName

public void setName(java.lang.String name)
Setter method for this ItemVO's name.

Parameters:
name - The name of this ItemVO object

getType

public Item.ItemType getType()
Getter method for this ItemVO's item type.

Specified by:
getType in interface Item
Returns:
The item type of this ItemVO

setType

public void setType(Item.ItemType type)
Setter method for this ItemVO's item type.

Parameters:
type - The item type of this ItemVO

getHitCount

public int getHitCount()
Getter method for this ItemVO's hit count.

Specified by:
getHitCount in interface Hittable
Returns:
The total number of times this ItemVO has been hit

setHitCount

public void setHitCount(int hitCount)
Setter method for this ItemVO's hit count.

Specified by:
setHitCount in interface Hittable
Parameters:
hitCount - The total number of times this ItemVO has been hit

getHitDate

public java.util.Date getHitDate()
Getter method for this ItemVO's hit date.

Specified by:
getHitDate in interface Hittable
Returns:
The date at which this ItemVO has been hit last

setHitDate

public void setHitDate(java.util.Date hitDate)
Setter method for this ItemVO's hit date.

Specified by:
setHitDate in interface Hittable
Parameters:
hitDate - The date at which this ItemVO has been hit last

hit

public void hit()
This method marks this ItemVO as hit. It adjusts its hit count and hit date accordingly.

Specified by:
hit in interface Hittable

compareTo

public int compareTo(java.lang.Object obj)
Comparison method for two ItemVOs. It compares the two objects by the combination of their item types and their names.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - An ItemVO object to compare this object to
Returns:
A negative number, if the ordinal of the item type of the first ItemVO is smaller than that of the second ItemVO; a positive number in the reverse case. If the two ItemVOs have the same item type, the return value is the result of the lexicographical comparison of the names of the two ItemVOs.

DJDoc v.1.0.0b-1