org.davesag.generica.core
Class CreditCard

java.lang.Object
  extended byorg.davesag.generica.core.CreditCard
All Implemented Interfaces:
Persistable, Serializable

public class CreditCard
extends Object
implements Persistable, Serializable

This CreditCard bean represents the information we know about a User's credit card.

Since:
Generica 1.0
Version:
CVS Revision $Id: CreditCard.java,v 1.11 2004/04/06 15:40:40 davesag Exp $
Author:
Dave Sag http://www.davesag.com
See Also:
Serialized Form
Peristable via Hibernate:
table = "credit_cards"

Field Summary
protected  String theCardNumber
          the card's number as a string
protected  Integer theExpiryMonth
          the card's expiry month, a two digit value between 01 and 12 used to verify the card
protected  Integer theExpiryYear
          the card's expiry year, a two digit value used to verify the card
protected  Long theId
          card's id used as a key by hibernate
protected  String theNameOnCard
          the name on the card
protected  BigInteger theNumber
          the card's number
protected  Integer theSecurityCode
          the 3 digit security code on the back of some cards
protected  String theType
          the card's type
 
Constructor Summary
CreditCard()
          null constructor required by hibernate.
CreditCard(BigInteger num, int expmth, int expyr, String noc)
          constructor takes card number, type, expiry date and name on card.
 
Method Summary
 String getCardNumber()
          Get the string varsion of the card number directly.
 Integer getExpiryMonth()
          get the expiry month.
 Integer getExpiryYear()
          get the expiry year.
 Long getId()
          Get the CreditCard's ID number.
 String getNameOnCard()
          get the name on the card.
 Integer getSecurityCode()
          get the security code.
 String getType()
          get the type.
protected  void setCardNumber(String num)
          Way for Hibernate to set the string varsion of the card number directly.
 void setExpiryMonth(int mth)
          Sets the expiry month as an int.
protected  void setExpiryMonth(Integer mth)
          Sets the expiry month of the card.
 void setExpiryYear(int yr)
          set the expiry year of the card as an int.
protected  void setExpiryYear(Integer yr)
          set the expiry year of the card.
protected  void setId(Long id)
          Sets the The CreditCard's ID number.
 void setNameOnCard(String name)
          set the name on the card.
 void setNumber(BigInteger num)
          set the card number.
protected  void setSecurityCode(Integer securitycode)
          set the security code of card.
 void setTemplateId(Long id)
          Sets the The CreditCard's ID number directly.
protected  void setType(String type)
          set the type of card.
 String toString()
          a simple string representation of this credit card.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

theId

protected Long theId
card's id used as a key by hibernate


theNumber

protected BigInteger theNumber
the card's number


theCardNumber

protected String theCardNumber
the card's number as a string


theType

protected String theType
the card's type


theExpiryMonth

protected Integer theExpiryMonth
the card's expiry month, a two digit value between 01 and 12 used to verify the card


theExpiryYear

protected Integer theExpiryYear
the card's expiry year, a two digit value used to verify the card


theNameOnCard

protected String theNameOnCard
the name on the card


theSecurityCode

protected Integer theSecurityCode
the 3 digit security code on the back of some cards

Constructor Detail

CreditCard

public CreditCard()
null constructor required by hibernate.


CreditCard

public CreditCard(BigInteger num,
                  int expmth,
                  int expyr,
                  String noc)
constructor takes card number, type, expiry date and name on card.

Parameters:
num - The card number.
expmth - The two digit expiry month. 01 = jan.
expyr - The two digit expiry year.
noc - The Name on the Card.
Method Detail

getId

public Long getId()
Get the CreditCard's ID number.

Specified by:
getId in interface Persistable
Returns:
The CreditCard's ID number.
Hibernate Unique ID Property:
generator-class = "identity" column = "id" type = "long"

setId

protected void setId(Long id)
Sets the The CreditCard's ID number.

Parameters:
id - The ID number to set.

setTemplateId

public void setTemplateId(Long id)
Sets the The CreditCard's ID number directly. This is only to be used when creating a template object, and is not to be used when creating actual objects that will be persisted.

Specified by:
setTemplateId in interface Persistable
Parameters:
id - The ID number to set.

setNumber

public void setNumber(BigInteger num)
               throws IllegalArgumentException
set the card number. you use this, not hibernate.

Parameters:
num - the card number.
Throws:
IllegalArgumentException - if the card number was invalid.

setCardNumber

protected void setCardNumber(String num)
Way for Hibernate to set the string varsion of the card number directly.

Parameters:
num - The string version of the card number.

getCardNumber

public String getCardNumber()
Get the string varsion of the card number directly.

Returns:
The string version of the card number.
Hibernate Property:
unique = "true" not-null = "true"

getSecurityCode

public Integer getSecurityCode()
get the security code.

Returns:
The security code of the card.
Hibernate Property:

setSecurityCode

protected void setSecurityCode(Integer securitycode)
set the security code of card.

Parameters:
securitycode - The security code of the card.

getType

public String getType()
get the type.

Returns:
The type of card.
Hibernate Property:
length = "20" not-null="true"

setType

protected void setType(String type)
set the type of card.

Parameters:
type - The type of card.

getExpiryMonth

public Integer getExpiryMonth()
get the expiry month.

Returns:
The expiry month of the card.
Hibernate Property:
not-null = "true"

setExpiryMonth

public void setExpiryMonth(int mth)
                    throws IllegalArgumentException
Sets the expiry month as an int. The value supplied must be in the range 1 through 12.

Parameters:
mth - The month number. January is 1.
Throws:
IllegalArgumentException - if the month provided was less than 1 or greater than 12.

setExpiryMonth

protected void setExpiryMonth(Integer mth)
Sets the expiry month of the card.

Parameters:
mth - The two digit expiry month.

getExpiryYear

public Integer getExpiryYear()
get the expiry year.

Returns:
The expiry year of the card.
Hibernate Property:
not-null = "true"

setExpiryYear

public void setExpiryYear(int yr)
set the expiry year of the card as an int.

Parameters:
yr - The two digit expiry year.

setExpiryYear

protected void setExpiryYear(Integer yr)
set the expiry year of the card.

Parameters:
yr - The two digit expiry year.

getNameOnCard

public String getNameOnCard()
get the name on the card.

Returns:
The name on the card.
Hibernate Property:
length = "55" not-null="true"

setNameOnCard

public void setNameOnCard(String name)
set the name on the card.

Parameters:
name - The name on the card.

toString

public String toString()
a simple string representation of this credit card.

Returns:
the credit card details


Dave Sag Generica API version 0.5.9 - (prerelease) Copyright 2003 - 2004 Dave Sag.