org.idoox.wasp.serialization.xsdbuiltin
Class DateTime

java.lang.Object
  extended byorg.idoox.wasp.serialization.xsdbuiltin.DateTimeBase
      extended byorg.idoox.wasp.serialization.xsdbuiltin.DateTime
All Implemented Interfaces:
java.io.Serializable

public class DateTime
extends DateTimeBase
implements java.io.Serializable

Class that represents xsd dateTime type.

See Also:
Serialized Form
Component:
Core

Field Summary
 
Fields inherited from class org.idoox.wasp.serialization.xsdbuiltin.DateTimeBase
isNegative, timeZone
 
Constructor Summary
DateTime(java.util.Date date)
          Constructor, initializes object.
DateTime(int year, int month, int day, int hour, int min, java.math.BigDecimal sec, TimeZone timeZone, boolean isNegative)
          Constructor.
DateTime(java.lang.String dateTime)
          Constructor that initializes this object.
 
Method Summary
 boolean equals(java.lang.Object o)
          Equals based on sec, day, hour, min, month, year and DateTimeBase values.
 int getDay()
          Returns day member of this object.
 int getHour()
          Returns hour member of this object.
 int getMin()
          Returns value of minute of this object.
 int getMinute()
          Returns value of minute of this object.
 int getMonth()
          Returns month member of this object in the interval 0-11.
 java.math.BigDecimal getSec()
          Returns second value of this object.
 java.math.BigDecimal getSecond()
          Returns second value of this object.
 int getYear()
          Returns year member of this object.
 int hashCode()
           
 void setDay(int day)
          Sets day to the given value.
 void setHour(int hour)
          Sets hour to the given value.
 void setMinute(int min)
          Sets minute to the given value.
 void setMonth(int month)
          Sets month to the given value (1-12).
 void setParams(java.util.Date date)
          Sets parameters of this object to the given java.util.Date object.
 void setParams(int year, int month, int day, int hour, int min, java.math.BigDecimal sec, TimeZone timeZone, boolean isNegative)
          Sets parameters of this object.
 void setSecond(java.math.BigDecimal sec)
          Sets seconds to the given value.
 void setYear(int year)
          Sets year to the given value.
 java.util.Date toJavaUtilDate()
          Converts parameters of this object to the java.util.Date Object.
 java.lang.String toString()
          Deserializes this object to XSD string that represents dateTime.
 
Methods inherited from class org.idoox.wasp.serialization.xsdbuiltin.DateTimeBase
getTimeZone, hasNegativeValue, inputMonth, outputMonth, setDefaultTimeZone, setParams
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateTime

public DateTime(int year,
                int month,
                int day,
                int hour,
                int min,
                java.math.BigDecimal sec,
                TimeZone timeZone,
                boolean isNegative)
         throws DateTimeException
Constructor. Initializes dateTime object. Input parameters must NOT be a negative number.

Parameters:
year - a value of year.
month - a value of month in the interval 0-11.
day - a value of day.
hour - a value of hour.
min - a value of minute.
sec - a value of second.
timeZone - a value of time zone. It may be null.
isNegative - indicates that it is negative dateTime.
Throws:
DateTimeException - thrown when parameters are invalid.

DateTime

public DateTime(java.lang.String dateTime)
         throws DateTimeException
Constructor that initializes this object.

Parameters:
dateTime - dateTime string in XMLSchema format.
Throws:
DateTimeException - thrown when parameters are invalid.

DateTime

public DateTime(java.util.Date date)
Constructor, initializes object. Sets parameters of this object to the given java.util.Date object. The DateTime object is being created with TimeZone 00:00 and other parameters got from a given java.util.Date object.

Parameters:
date - a date value to set.
Method Detail

setParams

public void setParams(int year,
                      int month,
                      int day,
                      int hour,
                      int min,
                      java.math.BigDecimal sec,
                      TimeZone timeZone,
                      boolean isNegative)
               throws DateTimeException
Sets parameters of this object. Parameters must NOT be negative. If parameter timeZone is null, date is UTC time.

Parameters:
year - a value of year.
month - a value of month in the interval 0-11.
day - a value of day.
hour - a value of hour.
min - a value of minute.
sec - a value of second.
timeZone - a value of time zone. It may be null.
isNegative - indicates that it is negative dateTime.
Throws:
DateTimeException - thrown when parameters are invalid.

setParams

public void setParams(java.util.Date date)
Sets parameters of this object to the given java.util.Date object. The object is being created with TimeZone 00:00 and other parameters got from a given java.util.Date object.

Parameters:
date - a date value to set.

toJavaUtilDate

public java.util.Date toJavaUtilDate()
Converts parameters of this object to the java.util.Date Object.

Returns:
the equivalent object.

toString

public java.lang.String toString()
Deserializes this object to XSD string that represents dateTime.

Returns:
date represent of the object.

getYear

public int getYear()
Returns year member of this object.

Returns:
year member of this object.

setYear

public void setYear(int year)
Sets year to the given value.

Parameters:
year - the given year to set to.

setMonth

public void setMonth(int month)
Sets month to the given value (1-12).

Parameters:
month - the given month to set to.

setDay

public void setDay(int day)
Sets day to the given value.

Parameters:
day - the given day to set to.

setHour

public void setHour(int hour)
Sets hour to the given value.

Parameters:
hour - the given hour to set to.

setMinute

public void setMinute(int min)
Sets minute to the given value.

Parameters:
min - the given minute to set to.

setSecond

public void setSecond(java.math.BigDecimal sec)
Sets seconds to the given value.

Parameters:
sec - the given seconds value to set to.

getMonth

public int getMonth()
Returns month member of this object in the interval 0-11.

Returns:
month member of this object in the interval 0-11.

getDay

public int getDay()
Returns day member of this object.

Returns:
day member of this object.

getHour

public int getHour()
Returns hour member of this object.

Returns:
hour member of this object.

getMin

public int getMin()
Returns value of minute of this object.

Returns:
value of minute of this object.

getMinute

public int getMinute()
Returns value of minute of this object.

Returns:
value of minute of this object.

getSec

public java.math.BigDecimal getSec()
Returns second value of this object.

Returns:
second value of this object.

getSecond

public java.math.BigDecimal getSecond()
Returns second value of this object.

Returns:
second value of this object.

equals

public boolean equals(java.lang.Object o)
Equals based on sec, day, hour, min, month, year and DateTimeBase values. All these values must be equal, for example no recalculation to different time zone is done.


hashCode

public int hashCode()