org.nakedobjects.object.value
Class TimeStamp

java.lang.Object
  extended byorg.nakedobjects.object.value.AbstractNakedValue
      extended byorg.nakedobjects.object.value.Magnitude
          extended byorg.nakedobjects.object.value.TimeStamp
All Implemented Interfaces:
java.io.Externalizable, Naked, NakedValue, java.io.Serializable

public class TimeStamp
extends Magnitude
implements java.io.Externalizable

Value object representing a date and time value.

NOTE: this class currently does not support about listeners

See Also:
Serialized Form

Constructor Summary
TimeStamp()
          Create a Time object for storing a timeStamp set to the current time.
TimeStamp(int year, int month, int day, int hour, int minute)
          Deprecated. replaced by TimeStamp(int year, int month, int day, int hour, int minute, int second)
TimeStamp(int year, int month, int day, int hour, int minute, int second)
          Create a Time object for storing a timeStamp set to the specified hours and minutes.
TimeStamp(TimeStamp timeStamp)
          Create a Time object for storing a timeStamp set to the specified time.
 
Method Summary
 void add(int hours, int minutes, int seconds)
          Add the specified days, years and months to this date value.
 java.util.Calendar calendarValue()
           
 void clear()
          Clears the value so that it is empty, i.e.
 void copyObject(Naked object)
          Copies the content of the specified object into this object.
 java.util.Date dateValue()
           
 boolean isEmpty()
          Return true if the time stamp is blank
 boolean isEqualTo(Magnitude timeStamp)
          returns true if the time stamp of this object has the same value as the specified time
 boolean isLessThan(Magnitude timeStamp)
          returns true if the timeStamp of this object is earlier than the specified timeStamp
 long longValue()
           
 void parse(java.lang.String text)
          Takes a user entry string which is parsed to set up the object.
 void readExternal(java.io.ObjectInput in)
           
 void reset()
          Reset this time so it contains the current time.
 void restoreString(java.lang.String data)
          Takes a storage string and uses it reinstate this value object to its previous state/
 java.lang.String saveString()
          Returns a basic string representation of this value for storage purposes.
 void setValue(java.util.Date date)
           
 void setValue(int year, int month, int day, int hour, int minute, int second)
           
 void setValue(long time)
           
 void setValue(TimeStamp timeStamp)
           
 Title title()
          Returns a Title object describing the object.
 java.lang.String toString()
          Returns a string representation of this object.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class org.nakedobjects.object.value.Magnitude
isBetween, isGreaterThan, isGreaterThanOrEqualTo, isLessThanOrEqualTo, isSameAs, max, min
 
Methods inherited from class org.nakedobjects.object.value.AbstractNakedValue
about, addNakedValueListener, checkCanOperate, contextualTitle, deepCopy, dumpObject, fireValueChanged, fireValueChanged, getClassName, getFullClassName, getLogger, getObjectHelpText, isNull, isValid, nakedValueListeners, removeNakedValueListener, setAbout, setNull, setValidity, summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeStamp

public TimeStamp()
Create a Time object for storing a timeStamp set to the current time.


TimeStamp

public TimeStamp(int year,
                 int month,
                 int day,
                 int hour,
                 int minute)
Deprecated. replaced by TimeStamp(int year, int month, int day, int hour, int minute, int second)

Create a Time object for storing a timeStamp set to the specified hours and minutes.


TimeStamp

public TimeStamp(int year,
                 int month,
                 int day,
                 int hour,
                 int minute,
                 int second)
Create a Time object for storing a timeStamp set to the specified hours and minutes.


TimeStamp

public TimeStamp(TimeStamp timeStamp)
Create a Time object for storing a timeStamp set to the specified time.

Method Detail

add

public void add(int hours,
                int minutes,
                int seconds)
Add the specified days, years and months to this date value.


clear

public void clear()
Description copied from interface: NakedValue
Clears the value so that it is empty, i.e. isEmpty returns true.

Specified by:
clear in interface NakedValue

copyObject

public void copyObject(Naked object)
Description copied from interface: Naked
Copies the content of the specified object into this object.

Specified by:
copyObject in interface Naked

dateValue

public java.util.Date dateValue()

isEmpty

public boolean isEmpty()
Return true if the time stamp is blank

Specified by:
isEmpty in interface Naked

isEqualTo

public boolean isEqualTo(Magnitude timeStamp)
returns true if the time stamp of this object has the same value as the specified time

Specified by:
isEqualTo in class Magnitude

isLessThan

public boolean isLessThan(Magnitude timeStamp)
returns true if the timeStamp of this object is earlier than the specified timeStamp

Specified by:
isLessThan in class Magnitude

longValue

public long longValue()

parse

public void parse(java.lang.String text)
           throws ValueParseException
Description copied from interface: NakedValue
Takes a user entry string which is parsed to set up the object. This needs to accomodate punctuation and adornments such as currency signs.

Specified by:
parse in interface NakedValue
Throws:
ValueParseException
See Also:
NakedValue.restoreString(String)

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

reset

public void reset()
Reset this time so it contains the current time.

Specified by:
reset in interface NakedValue
See Also:
NakedValue.reset()

setValue

public void setValue(java.util.Date date)

setValue

public void setValue(long time)

setValue

public void setValue(TimeStamp timeStamp)

setValue

public void setValue(int year,
                     int month,
                     int day,
                     int hour,
                     int minute,
                     int second)

title

public Title title()
Description copied from interface: Naked
Returns a Title object describing the object.

Specified by:
title in interface Naked

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

calendarValue

public java.util.Calendar calendarValue()

restoreString

public void restoreString(java.lang.String data)
Description copied from interface: NakedValue
Takes a storage string and uses it reinstate this value object to its previous state/

Specified by:
restoreString in interface NakedValue
Parameters:
data -
See Also:
NakedValue.parse(String)

saveString

public java.lang.String saveString()
Description copied from interface: NakedValue
Returns a basic string representation of this value for storage purposes.

Specified by:
saveString in interface NakedValue

toString

public java.lang.String toString()
Description copied from class: AbstractNakedValue
Returns a string representation of this object.

The specification of this string representation is not fixed, but, at the time of writing, consists of title [shortNakedClassName]

Overrides:
toString in class AbstractNakedValue
Returns:
string representation of object.