javax.wbem.cim
Class CIMDateTime

java.lang.Object
  |
  +--javax.wbem.cim.CIMDateTime
All Implemented Interfaces:
java.io.Serializable

public class CIMDateTime
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Constructor Summary
CIMDateTime()
          Create a CIMDateTime object using the current Time/Date of the system
CIMDateTime(java.util.Calendar c)
          Creates a CIMDateTime object using a Calendar
CIMDateTime(java.util.Date d)
          Creates a CIMDateTime object using a Date
CIMDateTime(java.lang.String dt)
          Creates a CIMDateTime object using a string
 
Method Summary
 boolean after(CIMDateTime when)
          Compares the CIMDateTime with this one
 boolean before(CIMDateTime when)
          Compares the CIMDateTime with this one
 boolean equals(java.lang.Object obj)
          Compares the CIMDateTime with this one
 java.util.Calendar getCalendar()
           
 boolean isInterval()
          Tests if this is an interval
 java.lang.String toMOF()
          Returns a MOF representation of the CIMDateTime
 java.lang.String toString()
          Returns a String representation of the CIMDateTime.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CIMDateTime

public CIMDateTime()
Create a CIMDateTime object using the current Time/Date of the system

CIMDateTime

public CIMDateTime(java.util.Date d)
Creates a CIMDateTime object using a Date
Parameters:
d - The date

CIMDateTime

public CIMDateTime(java.util.Calendar c)
Creates a CIMDateTime object using a Calendar
Parameters:
c - The calendar

CIMDateTime

public CIMDateTime(java.lang.String dt)
            throws java.lang.IllegalArgumentException
Creates a CIMDateTime object using a string
Parameters:
dt - A string in the format of yyyyMMddHHmmss.SSSSSSsutc
Throws:
java.lang.IllegalArgumentException - if string is not int the correct format
Method Detail

getCalendar

public java.util.Calendar getCalendar()
                               throws java.lang.IllegalArgumentException
Returns:
Calendar object for the date/time.
Throws:
java.lang.IllegalArgumentException - if this object refers to an interval instead of a date/time

isInterval

public boolean isInterval()
Tests if this is an interval
Returns:
boolean true if this is an interal value; false otherwise

toString

public java.lang.String toString()
Returns a String representation of the CIMDateTime. This method is intended to be used only for debugging purposes, and the format of the returned string may vary between implementations. The returned string may be empty but may not be null.
Overrides:
toString in class java.lang.Object
Returns:
string representation of this datetime

toMOF

public java.lang.String toMOF()
Returns a MOF representation of the CIMDateTime
Returns:
String Managed Object Format (MOF) representation of this datetime

after

public boolean after(CIMDateTime when)
              throws java.lang.IllegalArgumentException
Compares the CIMDateTime with this one
Parameters:
when - The CIMDateTime to be compared with this object
Returns:
boolean true if the current CIMDateTime is after the CIMDateTime of when; false otherwise If comparing interval values, returns true if current interval is greater then when, false otherwise
Throws:
java.lang.IllegalArgumentException - if one object refers to an interval and the other does not.

before

public boolean before(CIMDateTime when)
               throws java.lang.IllegalArgumentException
Compares the CIMDateTime with this one
Parameters:
when - The CIMDateTime to be compared with this object
Returns:
boolean true if the current CIMDateTime is before the CIMDateTime of when; false otherwise If comparing interval values, returns true if current interval is less then when, false otherwise
Throws:
java.lang.IllegalArgumentException - if one object refers to an interval and the other does not.

equals

public boolean equals(java.lang.Object obj)
               throws java.lang.IllegalArgumentException
Compares the CIMDateTime with this one
Overrides:
equals in class java.lang.Object
Parameters:
obj - The CIMDateTime to be compared with this one
Returns:
boolean true if the objects are the same; false otherwise
Throws:
java.lang.IllegalArgumentException - if one object refers to an interval and the other does not.