public class Date extends DATE implements NativeTypeDomainInterface, java.lang.Comparable, XMLDomainWriter, KeyAttributeInterface, ORAData, OracleData, java.io.Serializable
The intent of many of the methods in this class is to wrap the corresponding method in the oracle.sql class such that it returns an instance of an oracle.jbo.domain.* object.
The oracle.jbo.domain.Date class is the Java representation of the underlying database type that you must use if you want to exploit the domain feature of Business Components for Java.
 Date objects consist of data (a byte array)
 and a Domain type code.
 Domain dates extend SQL dates by being convertable to and from
 JDBC values.
 
   ...
  Date convertedDate = new Date();
  String convertedDateString;
  java.text.SimpleDateFormat displayDateFormat = new java.text.SimpleDateFormat ("MM/dd/yyyy");
  convertedDateString = displayDateFormat.format(convertedDate.dateValue());
 
 
... oracle.jbo.domain.Date dt = row.getBirthDate(); java.sql.Date ts = (java.sql.Date) dt.dateValue(); // since java.sql.Date is a java.util.Date, then... Calendar c = Calendar.getInstance(); c.setTime(dt); ...
| Modifier and Type | Field and Description | 
|---|---|
static java.sql.Time | 
ZERO_TIME  | 
| Constructor and Description | 
|---|
Date()
Creates a default  
Date Domain object. | 
Date(byte[] value)
Internal: Applications should not invoke this method. 
 | 
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(DATE value)
Creates a  
Date Domain object from an Oracle SQL
 DATE. | 
Date(java.sql.Date value,
    boolean bConvertToUserTZ)
Creates a  
Date Domain object from a JDBC
 Date. | 
Date(java.sql.Date value,
    java.util.Calendar cal)
Creates a  
Date Domain object from a JDBC
 Date. | 
Date(java.lang.Object value)
Creates a  
Date Domain object from a
 JDBC Object. | 
Date(java.lang.String value)
Creates a  
Date Domain object from a
 Java String. | 
Date(java.lang.String value,
    boolean bConvertToUserTZ)
Creates a  
Date Domain object from a
 Java String. | 
Date(java.lang.String value,
    java.util.Calendar cal)
Creates a  
Date Domain object from a
 Java String. | 
Date(java.sql.Time value)
Creates a  
Date Domain object from a JDBC
 Time object. | 
Date(java.sql.Time value,
    boolean bConvertToUserTZ)
Creates a  
Date Domain object from a JDBC
 Time object. | 
Date(java.sql.Time value,
    java.util.Calendar cal)
Creates a  
Date Domain object from a JDBC
 Time object. | 
Date(java.sql.Timestamp value)
Creates a  
Date Domain object from a JDBC
 Timestamp object. | 
Date(java.sql.Timestamp value,
    boolean bConvertToUserTZ)
Creates a  
Date Domain object from a JDBC
 Timestamp object. | 
Date(java.sql.Timestamp value,
    java.util.Calendar cal)
Creates a  
Date Domain object from a JDBC
 Timestamp object. | 
| Modifier and Type | Method and Description | 
|---|---|
DATE | 
addJulianDays(int julianDay,
             int julianSec)
Adds the number of Julian days to a DateDomain. 
 | 
DATE | 
addMonths(int months)
Adds months to a date. 
 | 
int | 
compareTo(java.lang.Object n)  | 
Number | 
diffInMonths(Date date)
Calculates the difference between two dates in months. 
 | 
NUMBER | 
diffInMonths(DATE date)
Calculates the difference between two dates in months. 
 | 
boolean | 
equals(java.lang.Object other)
Tests  
this for equality with another object. | 
static DATE | 
fromJulianDays(int julianDay,
              int julianSec)
Converts given Julian days and seconds to a date. 
 | 
static DATE | 
fromText(java.lang.String datestr,
        java.lang.String fmt,
        java.lang.String lang)
Converts a formatted string to a date. 
 | 
static DATE | 
getCurrentDate()
Gets current date and time. 
 | 
java.lang.Object | 
getData()
Internal: Applications should not invoke this method. 
 | 
java.lang.Object | 
getNativeObject()  | 
static ORADataFactory | 
getORADataFactory()
Internal: Applications should not invoke this method. 
 | 
Node | 
getSerializedDomainXML(Document xmlDoc)
Creates the xml node in the given xml document for this domain's data in hex format of the byte[]
 representation of the data. 
 | 
java.util.Date | 
getValue()
Return a java.util.Date object with this domain's value. 
 | 
Node | 
getXMLContentNode(Document xmlDoc)
Creates the xml node in the given xml document for this domain's data. 
 | 
static XMLDomainReaderFactory | 
getXMLDomainFactory(java.lang.Class attrClass)
Internal: Applications should not use this method. 
 | 
int | 
hashCode()
Computes a hash code for  
this. | 
DATE | 
lastDayOfMonth()
Returns a date intialized to the last day of the month. 
 | 
static void | 
main(java.lang.String[] argv)
Internal: Applications should not invoke this method. 
 | 
static long | 
parseISO8601FormatString(java.lang.String value)
Utility method to parse date strings in ISO8601 formats. 
 | 
java.lang.String | 
printXMLDefinition(java.util.Hashtable allDefs,
                  java.io.PrintWriter pw,
                  boolean bContainees)
Prints the DTD info for this domain in the given print writer. 
 | 
DATE | 
round(java.lang.String prec)
Returns a date rounded to a specified precision. 
 | 
void | 
setContext(DomainOwnerInterface owner,
          Transaction trans,
          java.lang.Object ctx)
Internal: Applications should not invoke this method. 
 | 
DATE | 
setDayOfWeek(int day)
Returns a date initialized to a date advanced to the week of the day
 specified. 
 | 
static Date | 
toDate(java.lang.String value)
Converts an Oracle Date expressed as a string to a Java Date. 
 | 
Datum | 
toDatum(java.sql.Connection conn)
Internal: Applications should not invoke this method. 
 | 
java.lang.Object | 
toJDBCObject(java.sql.Connection connection)  | 
NUMBER | 
toNumber()
Converts this date to an oracle.sql.NUMBER. 
 | 
java.lang.String | 
toString()  | 
DATE | 
truncate(java.lang.String prec)
Returns a date truncated to a specified precision. 
 | 
checkValidity, compareTo, dateValue, dateValue, diffInJulianDays, isConvertibleTo, makeJdbcArray, numberToJulianDays, parseFormat, stringValue, timestampValue, timestampValue, timeValue, timeValue, toBytes, toBytes, toBytes, toBytes, toBytes, toBytes, toBytes, toBytes, toBytes, toDate, toDate, toJdbc, toJulianDays, toString, toText, toText, toTime, toTime, toTimestamp, toTimestampasciiStreamValue, bigDecimalValue, binaryStreamValue, booleanValue, bytesEqual, byteValue, characterStreamValue, compareBytes, doubleValue, floatValue, getBytes, getConnectionDuringExceptionHandling, getLength, getStream, intValue, isNull, longValue, setBytes, setShareBytes, shareBytes, stringValue, toClassclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetBytes, setBytespublic Date()
Date Domain object.
 This constructor does not create a null date:
 use one of the NullValue() constructors.
public Date(byte[] value)
Creates a Date Domain object from the given byte array.
value - a value returned by a previous call to
 getBytes() on an SQL object compatable with
 Date.public Date(DATE value)
Date Domain object from an Oracle SQL
 DATE.value - a DATE SQL object.public Date(Date value)
Date identical to an
 existing Date.value - a Date Domain object.public Date(java.sql.Date value)
Date Domain object from a JDBC
 Date.value - a DATE SQL object.public Date(java.sql.Time value)
Date Domain object from a JDBC
 Time object.value - a Time SQL object.public Date(java.sql.Timestamp value)
Date Domain object from a JDBC
 Timestamp object.value - a TimeStamp SQL object.public Date(java.lang.Object value)
     throws java.sql.SQLException
Date Domain object from a
 JDBC Object.value - an Object that is an instance of
 Date,
 Time, Timestamp, or
 String.java.sql.SQLException - if the object is not of one of the recognized classes.public Date(java.lang.String value)
Date Domain object from a
 Java String.value - a textual representation of a Date.public Date(java.sql.Date value,
    boolean bConvertToUserTZ)
Date Domain object from a JDBC
 Date.value - a DATE SQL object.bConvertToUserTZ - if this flag is true
        then the date is converted to the user time zone. User
        Time zone is obtained from the ADF Context. It is typically
        configured in the application settings.public Date(java.sql.Date value,
    java.util.Calendar cal)
Date Domain object from a JDBC
 Date.value - a DATE SQL object.cal - converts the value to the timezone 
        in the cal argument.public Date(java.sql.Time value,
    boolean bConvertToUserTZ)
Date Domain object from a JDBC
 Time object.value - a Time SQL object.bConvertToUserTZ - if this flag is true
        then the date is converted to the user time zone. User
        Time zone is obtained from the ADF Context. It is typically
        configured in the application settings.public Date(java.sql.Time value,
    java.util.Calendar cal)
Date Domain object from a JDBC
 Time object.value - a Time SQL object.cal - converts the value to the timezone 
        in the cal argument.public Date(java.sql.Timestamp value,
    boolean bConvertToUserTZ)
Date Domain object from a JDBC
 Timestamp object.value - a TimeStamp SQL object.bConvertToUserTZ - if this flag is true
        then the date is converted to the user time zone. User
        Time zone is obtained from the ADF Context. It is typically
        configured in the application settings.public Date(java.sql.Timestamp value,
    java.util.Calendar cal)
Date Domain object from a JDBC
 Timestamp object.value - a TimeStamp SQL object.cal - converts the value to the timezone 
        in the cal argument.public Date(java.lang.String value,
    boolean bConvertToUserTZ)
Date Domain object from a
 Java String.value - a textual representation of a Date.bConvertToUserTZ - if this flag is true
        then the date is converted to the user time zone. User
        Time zone is obtained from the ADF Context. It is typically
        configured in the application settings.public Date(java.lang.String value,
    java.util.Calendar cal)
Date Domain object from a
 Java String.value - a textual representation of a Date.cal - converts the value to the timezone 
        in the cal argument.public static ORADataFactory getORADataFactory()
Initializes the Date Domain.
 
This method is invoked when JBO is initialized. Applications should not call this method directly.
ORADataFactory for the
 Date Domain.public Datum toDatum(java.sql.Connection conn) throws java.sql.SQLException
Converts this Date Domain object back into an
 SQL DATE object.
public java.lang.Object getNativeObject()
getNativeObject in interface NativeTypeDomainInterfacepublic java.util.Date getValue()
public java.lang.Object getData()
getData in interface DomainInterfacepublic int compareTo(java.lang.Object n)
compareTo in interface java.lang.Comparablepublic void setContext(DomainOwnerInterface owner, Transaction trans, java.lang.Object ctx)
setContext in interface DomainInterfacepublic static Date toDate(java.lang.String value)
public static long parseISO8601FormatString(java.lang.String value)
| Format | Example | |
|---|---|---|
| YYYY-MM-DDThh:mm:ss | 2010-08-08T05:34:27 | Calendar date and local time | 
| YYYY-MM-DDThh:mm:ss?hh:mm | 2010-08-08T05:34:27-07:00 | Calendar date and local time and UTC offset | 
| YYYY-MM-DDThh:mm:ssZ | 2010-08-08T12:34:27Z | Calendar date and UTC time | 
| YYYY-MM-DDThh:mm:ss.sss | 2010-08-08T05:34:27.213 | Calendar date and local time with milliseconds (three decimals for the fraction) | 
| YYYY-MM-DDThh:mm:ss.sss?hh:mm | 2010-08-08T05:34:27.213-07:00 | Calendar date and local time with milliseconds and UTC offset | 
| YYYY-MM-DDThh:mm:ss.sssZ | 2010-08-08T12:34:27.213Z | Calendar date and UTC time with milliseconds | 
value - java.lang.IllegalArgumentException - if the date string is not parsable using the above ISO8601 formatspublic boolean equals(java.lang.Object other)
this for equality with another object.
 The argument is converted to a Date object, if necessary.public int hashCode()
this.hashCode in class java.lang.Objectthis.public DATE addJulianDays(int julianDay, int julianSec)
Date Domain object initalized to the DATE
 values added to the Julian days.addJulianDays in class DATEjulianDay - number of Julian days to add to Date.julianSec - number of seconds past midnight.Date Domain object.GenericDomainExceptionpublic DATE addMonths(int months)
Date Domain object.public Number diffInMonths(Date date)
Date Domain object.date - Date to be subtracted as a DateDomain.public NUMBER diffInMonths(DATE date)
Date Domain object.diffInMonths in class DATEdate - Date to be subtracted, as an oracle.sql.DATE.public static DATE getCurrentDate()
Date Domain object.public static DATE fromJulianDays(int julianDay, int julianSec)
Date Domain object.julianDay - Number of Julian daysjulianSec - Number of seconds past midnightGenericDomainExceptionpublic static DATE fromText(java.lang.String datestr, java.lang.String fmt, java.lang.String lang)
Date Domain object.
 param datestr text to convertfmt - formatlang - the NLS language the conversion is to be performed in,
 null indicates use default.GenericDomainExceptionpublic DATE lastDayOfMonth()
Date Domain object.lastDayOfMonth in class DATEGenericDomainExceptionpublic DATE round(java.lang.String prec)
Date Domain object.round in class DATEprec - precision to use while roundingGenericDomainExceptionpublic DATE setDayOfWeek(int day)
Date Domain object.setDayOfWeek in class DATEday - day of the week the date needs to be advancedGenericDomainExceptionpublic NUMBER toNumber()
toNumber in class DATEDate Domain object.GenericDomainExceptionpublic DATE truncate(java.lang.String prec)
truncate in class DATEprec - precision to use while truncatingDate Domain object.GenericDomainExceptionpublic java.lang.String printXMLDefinition(java.util.Hashtable allDefs,
                                  java.io.PrintWriter pw,
                                  boolean bContainees)
The allDefs hashtable contains predefined XML definitions and is passed by whatever calls this method.
printXMLDefinition in interface XMLDomainInterfaceallDefs - a hashtable of predefined XML definitions passed from whatever
 calls this method.pw - print writer into which the defnition is being printed.bContainees - if true, prints definitions of contained objects.public Node getXMLContentNode(Document xmlDoc)
getXMLContentNode in interface XMLDomainInterfacexmlDoc - name of the XML document in which the node should be created.public Node getSerializedDomainXML(Document xmlDoc)
getSerializedDomainXML in interface XMLDomainWriterxmlDoc - name of the XML document in which the node should be created.public static XMLDomainReaderFactory getXMLDomainFactory(java.lang.Class attrClass)
public static void main(java.lang.String[] argv)
                 throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.Object toJDBCObject(java.sql.Connection connection)
                              throws java.sql.SQLException
toJDBCObject in interface OracleDatajava.sql.SQLException