ch7.catalog
Class CatalogItem

java.lang.Object
  extended by shared.PersistentBase
      extended by ch7.catalog.CatalogItem
All Implemented Interfaces:
java.io.Serializable

public class CatalogItem
extends PersistentBase
implements java.io.Serializable

A bean that represents an item in the catalog database.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class shared.PersistentBase
id
 
Constructor Summary
CatalogItem()
          Creates a new instance of CatalogItem
CatalogItem(java.lang.String itemId, java.lang.String name, java.lang.String description, double price)
          Non-default constructor that initialises all the fields.
 
Method Summary
 java.lang.String getDescription()
          Accessor for the description.
 java.lang.String getItemId()
          Accessor for the item ID.
 java.lang.String getName()
          Accessor for the name.
 double getPrice()
          Accessor for the price.
 void setDescription(java.lang.String description)
          Mutator for the description.
 void setItemId(java.lang.String itemId)
          Mutator for the item ID.
 void setName(java.lang.String name)
          The mutator for the name.
 void setPrice(double price)
          Mutator for the price.
 
Methods inherited from class shared.PersistentBase
getId, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CatalogItem

public CatalogItem()
Creates a new instance of CatalogItem


CatalogItem

public CatalogItem(java.lang.String itemId,
                   java.lang.String name,
                   java.lang.String description,
                   double price)
Non-default constructor that initialises all the fields.

Parameters:
itemId - The item ID
name - The name of the book
description - The description of the book
price - The price of the book
Method Detail

getName

@Length(min=1,
        max=50)
public java.lang.String getName()
Accessor for the name.

It is annotated with the Length attribute, to give Hibernate a hint about how big to make the column in the database.

Returns:
name

setName

public void setName(java.lang.String name)
The mutator for the name.

Parameters:
name - Element data from the request

getDescription

public java.lang.String getDescription()
Accessor for the description.

It is annotated with the Lob annotation, to give Hibernate a hint that this is a large binary object. Hibernate will use this information to allow arbitrarily large amounts of data to be stored in the column.

Returns:
description

setDescription

public void setDescription(java.lang.String description)
Mutator for the description.

Parameters:
description - Element data from the request

getItemId

@NotNull
@Length(min=1,
        max=10)
public java.lang.String getItemId()
Accessor for the item ID.

The ID cannot be null and must be no longer than ten characters.

It is annotated with the Length attribute, to give Hibernate a hint about how big to make the column in the database.

Returns:
id

setItemId

public void setItemId(java.lang.String itemId)
Mutator for the item ID.

Parameters:
itemId - Element data from the request

getPrice

public double getPrice()
Accessor for the price.

Returns:
price Element data from the request

setPrice

public void setPrice(double price)
Mutator for the price.

Parameters:
price - Element data from the request