org.jtheque.utils.bean
Class IntDate

java.lang.Object
  extended by org.jtheque.utils.bean.IntDate
All Implemented Interfaces:
Serializable, Comparable<IntDate>

public final class IntDate
extends Object
implements Serializable, Comparable<IntDate>

This class represent an int data in format yyyymmdd.

Author:
Baptiste Wicht
See Also:
Serialized Form

Nested Class Summary
static class IntDate.Fields
          This internal class contains all the different fields of an IntDate.
 
Constructor Summary
IntDate(int date)
          Construct a new int date from the int representation of the date.
IntDate(IntDate value)
          Construct a new IntDate from an another one.
 
Method Summary
 void add(int field, int toAdd)
          Add a value to specified field of the date.
 int compareTo(IntDate o)
           
 boolean equals(Object o)
           
 int getDay()
          Return the day.
 int getMonth()
          Return the month.
 String getStrDate()
          Return the String representation of the date.
 int getYear()
          Return the year.
 int hashCode()
           
 int intValue()
          Return the int value of the date.
 void set(int field, int value)
          Set the value of a specified field of the date.
static IntDate today()
          Return the IntDate of today.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntDate

public IntDate(int date)
Construct a new int date from the int representation of the date.

Parameters:
date - The int representation (yyyymmdd) of the date.

IntDate

public IntDate(IntDate value)
Construct a new IntDate from an another one.

Parameters:
value - The another IntDate.
Method Detail

getDay

public int getDay()
Return the day.

Returns:
The day.

getYear

public int getYear()
Return the year.

Returns:
The year.

getMonth

public int getMonth()
Return the month.

Returns:
The month.

add

public void add(int field,
                int toAdd)
Add a value to specified field of the date.

Parameters:
field - The field to add the value to.
toAdd - The value to add.
Throws:
IllegalArgumentException - if the specified field is not valid.

set

public void set(int field,
                int value)
Set the value of a specified field of the date.

Parameters:
field - The field to set the value to.
value - The value to set to the field.

getStrDate

public String getStrDate()
Return the String representation of the date.

Returns:
A String representing the date.

today

public static IntDate today()
Return the IntDate of today.

Returns:
The today IntDate

intValue

public int intValue()
Return the int value of the date.

Returns:
A int representation of the date

compareTo

public int compareTo(IntDate o)
Specified by:
compareTo in interface Comparable<IntDate>

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010 JTheque. All Rights Reserved.