Oracle Fusion Middleware Java API Reference for Oracle Generic Domains
11g Release 1 (11.1.1)

E10655-04

oracle.jbo.domain
Class Date

java.lang.Object
  extended by oracle.jbo.domain.Date
All Implemented Interfaces:
java.io.Serializable, oracle.jbo.domain.DomainInterface

public class Date
extends java.lang.Object
implements oracle.jbo.domain.DomainInterface, java.io.Serializable

This class provides a lightweight wrapper for java.sql.Date, the native Java type for date objects. This wrapper allows an instance of the java.sql.Date to be used as a domain object. The intent of many of the methods in this class is to wrap the corresponding method in the java.sql.Date class such that it returns an instance of an oracle.jbo.domain.Date object.

Since:
JDevloper 3.1
See Also:
Serialized Form

Constructor Summary
Date()
          Creates a default Date Domain object, representing the time now.
Date(Date value)
          Creates a Date identical to an existing Date.
Date(java.sql.Date value)
          Creates a Date Domain object from a JDBC Date.
Date(long millis)
           
Date(java.lang.Object value)
           
Date(java.lang.String value)
          Creates a Date Domain object from a Java String.
 
Method Summary
 int compareTo(Date dt)
          Returns -1 if Date is less than , 0 if Date and dt are equal (==), 1 if Date is greater than dt.
 java.sql.Date dateValue()
           
 boolean equals(java.lang.Object other)
          Tests this for equality with another object.
 java.lang.Object getData()
           
 long getTime()
           
 java.util.Date getValue()
          Return a java.util.Date object with this domain's value.
 int hashCode()
          Computes a hash code for this.
 void setContext(oracle.jbo.domain.DomainOwnerInterface owner, oracle.jbo.Transaction trans, java.lang.Object ctx)
           
 java.lang.String toString()
          Converts this to a textual representation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Date

public Date()
Creates a default Date Domain object, representing the time now.


Date

public Date(Date value)
Creates a Date identical to an existing Date.

Parameters:
value - a Date Domain object.

Date

public Date(long millis)

Date

public Date(java.sql.Date value)
Creates a Date Domain object from a JDBC Date.

Parameters:
value - a DATE SQL object.

Date

public Date(java.lang.String value)
Creates a Date Domain object from a Java String.

Note that we accept either a date string: "YYYY-MM-DD" or a timestamp sting: "YYYY-MM-DD HH:MI:SS.D"

Parameters:
value - a textual representation of a Date.

Date

public Date(java.lang.Object value)
Method Detail

getTime

public long getTime()

getValue

public java.util.Date getValue()
Return a java.util.Date object with this domain's value. This method may be used to access the value for this domain in EL-expressions.


getData

public java.lang.Object getData()
Specified by:
getData in interface oracle.jbo.domain.DomainInterface

setContext

public void setContext(oracle.jbo.domain.DomainOwnerInterface owner,
                       oracle.jbo.Transaction trans,
                       java.lang.Object ctx)
Specified by:
setContext in interface oracle.jbo.domain.DomainInterface

toString

public java.lang.String toString()
Converts this to a textual representation.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Tests this for equality with another object. The argument is cast to a Date object, if possible.

Overrides:
equals in class java.lang.Object
Parameters:
other - an arbitrary Object.
Returns:
true if conversion was successful and the converted argument is identical to this.

compareTo

public int compareTo(Date dt)
Returns -1 if Date is less than , 0 if Date and dt are equal (==), 1 if Date is greater than dt.

Parameters:
dt - input Oracle Date
Returns:
integer result of comparison

hashCode

public int hashCode()
Computes a hash code for this.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code of this.

dateValue

public java.sql.Date dateValue()

Oracle Fusion Middleware Java API Reference for Oracle Generic Domains
11g Release 1 (11.1.1)

E10655-04

Copyright © 1997, 2010, Oracle. All rights reserved.