Last update: 2011-06-23

org.proteios.core
Class DateUtil

java.lang.Object
  extended by org.proteios.core.DateUtil

public class DateUtil
extends Object

Utility methods that will make it easier to handle date values. Especially, dates must be cloned whenver they are returned to or passed from client applications.

Version:
2.0
Author:
Nicklas

Constructor Summary
DateUtil()
           
 
Method Summary
static Date copy(Date value)
          Get a copy of the date.
static Date parseString(String value)
           
static Date setNotNullDate(Date value, String name)
          Make a copy of a Date object.
static Date setNullableDate(Date value, String name)
          Make a copy of a Date object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateUtil

public DateUtil()
Method Detail

setNullableDate

public static Date setNullableDate(Date value,
                                   String name)
Make a copy of a Date object. Null values are allowed.

Parameters:
value - The date to check
name - The name of the attribute to use if an exception is thrown
Returns:
A copy of the original date

setNotNullDate

public static Date setNotNullDate(Date value,
                                  String name)
                           throws InvalidUseOfNullException
Make a copy of a Date object. Null values are not allowed.

Parameters:
value - The date to check
name - The name of the attribute to use if an exception is thrown
Returns:
A copy of the original date
Throws:
InvalidUseOfNullException

copy

public static Date copy(Date value)
Get a copy of the date. Null values are allowed.


parseString

public static Date parseString(String value)
                        throws InvalidDataException
Throws:
InvalidDataException

Last update: 2011-06-23