org.nakedobjects.object.value
Class Time

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

public class Time
extends Magnitude
implements java.io.Externalizable

Value object representing a time value.

NOTE: this class currently does not support about listeners

See Also:
Serialized Form

Constructor Summary
Time()
           
Time(int hour, int minute)
           
Time(Time time)
           
 
Method Summary
 void add(int hours, int minutes)
          Add the specified hours and minutes to this time 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()
           
 java.util.Date getDate()
          Deprecated. replaced by dateValue
 boolean isEmpty()
          Return true if the date is blank
 boolean isEqualTo(Magnitude time)
          returns true if the time of this object has the same value as the specified time
 boolean isLessThan(Magnitude time)
          returns true if the time of this object is earlier than the specified time
 long longValue()
          The number of seconds since midnight.
 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 hour, int minute)
           
 void setValue(Time time)
           
 Title title()
          Returns a Title object describing the 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, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Time

public Time()

Time

public Time(int hour,
            int minute)

Time

public Time(Time time)
Method Detail

add

public void add(int hours,
                int minutes)
Add the specified hours and minutes to this time 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()

getDate

public java.util.Date getDate()
Deprecated. replaced by dateValue

See Also:
dateValue()

isEmpty

public boolean isEmpty()
Return true if the date is blank

Specified by:
isEmpty in interface Naked

isEqualTo

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

Specified by:
isEqualTo in class Magnitude

isLessThan

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

Specified by:
isLessThan in class Magnitude

longValue

public long longValue()
The number of seconds since midnight.


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(int hour,
                     int minute)

setValue

public void setValue(Time time)

setValue

public void setValue(java.util.Date date)

title

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

Specified by:
title in interface Naked

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

writeExternal

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