proper.relaggs
Class RelaggsDate

java.lang.Object
  extended by proper.relaggs.RelaggsDate

public class RelaggsDate
extends java.lang.Object

Title: RelaggsDate Description: Stores the date in different formats.

Version:
$Revision: 1.1 $
Author:
Susanne Streuer

Field Summary
static int TYPE_Y
          Constant representing a YEAR format.
static int TYPE_YM
          Constant representing a YEAR-MONTH format.
static int TYPE_YMD
          Constant representing a YEAR-MONTH-DAY format.
 
Constructor Summary
RelaggsDate(java.sql.Date date)
          Creates a new RelaggsDate in the Year-Month-Day format.
RelaggsDate(java.sql.Date date, int type)
          Creates a new RelaggsDate in the the given format type.
RelaggsDate(java.lang.String hash_key)
          Creates a new RelaggsDate from the hash key.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Return whether this RelaggsDate equals the given object.
 java.lang.String getColumnString()
          Returns the part of the column name that represents the date defined by this object according to the type.
 int getDay()
          Returns the day of the date.
 java.lang.String getHashKey()
          Returns the hash key of the date.
 int getMonth()
          Returns the month of the date.
 int getType()
          Returns the type format of the date.
 int getYear()
          Returns the year of the date.
 java.lang.String toString()
          Returns the date in the format: 'YEAR-MONTH-DAY [FORMAT_TYPE]'
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_YMD

public static final int TYPE_YMD
Constant representing a YEAR-MONTH-DAY format.

See Also:
Constant Field Values

TYPE_YM

public static final int TYPE_YM
Constant representing a YEAR-MONTH format.

See Also:
Constant Field Values

TYPE_Y

public static final int TYPE_Y
Constant representing a YEAR format.

See Also:
Constant Field Values
Constructor Detail

RelaggsDate

public RelaggsDate(java.sql.Date date)
Creates a new RelaggsDate in the Year-Month-Day format.

Parameters:
date - the date to store

RelaggsDate

public RelaggsDate(java.sql.Date date,
                   int type)
Creates a new RelaggsDate in the the given format type.

Parameters:
date - the date to store
type - the format type (TYPE_YMD, TYPE_YM, TYPE_Y)

RelaggsDate

public RelaggsDate(java.lang.String hash_key)
Creates a new RelaggsDate from the hash key.

Parameters:
hash_key - the hash key representing the date
Method Detail

equals

public boolean equals(java.lang.Object obj)
Return whether this RelaggsDate equals the given object. The type format and the date value must be equal.

Overrides:
equals in class java.lang.Object

getType

public int getType()
Returns the type format of the date.


getDay

public int getDay()
Returns the day of the date.


getMonth

public int getMonth()
Returns the month of the date.


getYear

public int getYear()
Returns the year of the date.


getHashKey

public java.lang.String getHashKey()
Returns the hash key of the date.


getColumnString

public java.lang.String getColumnString()
Returns the part of the column name that represents the date defined by this object according to the type.


toString

public java.lang.String toString()
Returns the date in the format: 'YEAR-MONTH-DAY [FORMAT_TYPE]'

Overrides:
toString in class java.lang.Object