Package com.documentum.fc.common
Class DfTime
java.lang.Object
com.documentum.fc.common.DfObject
com.documentum.fc.common.DfTime
- All Implemented Interfaces:
IDfTime,Externalizable,Serializable
public final class DfTime
extends com.documentum.fc.common.DfObject
implements IDfTime, Externalizable
An implementation of the IDfTime interface.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DfTimestatic final Stringstatic final DfTimestatic final StringFields inherited from interface com.documentum.fc.common.IDfTime
DF_TIME_PATTERN_DEFAULT, DF_TIME_PATTERN1, DF_TIME_PATTERN10, DF_TIME_PATTERN11, DF_TIME_PATTERN12, DF_TIME_PATTERN13, DF_TIME_PATTERN14, DF_TIME_PATTERN15, DF_TIME_PATTERN16, DF_TIME_PATTERN17, DF_TIME_PATTERN18, DF_TIME_PATTERN19, DF_TIME_PATTERN2, DF_TIME_PATTERN20, DF_TIME_PATTERN21, DF_TIME_PATTERN22, DF_TIME_PATTERN23, DF_TIME_PATTERN24, DF_TIME_PATTERN25, DF_TIME_PATTERN26, DF_TIME_PATTERN27, DF_TIME_PATTERN28, DF_TIME_PATTERN29, DF_TIME_PATTERN3, DF_TIME_PATTERN30, DF_TIME_PATTERN31, DF_TIME_PATTERN32, DF_TIME_PATTERN33, DF_TIME_PATTERN34, DF_TIME_PATTERN35, DF_TIME_PATTERN36, DF_TIME_PATTERN37, DF_TIME_PATTERN38, DF_TIME_PATTERN39, DF_TIME_PATTERN4, DF_TIME_PATTERN40, DF_TIME_PATTERN41, DF_TIME_PATTERN42, DF_TIME_PATTERN43, DF_TIME_PATTERN44, DF_TIME_PATTERN45, DF_TIME_PATTERN46, DF_TIME_PATTERN5, DF_TIME_PATTERN6, DF_TIME_PATTERN7, DF_TIME_PATTERN8, DF_TIME_PATTERN9 -
Constructor Summary
ConstructorsConstructorDescriptionDfTime()Creates a new DfTime object initialized to the current date.Creates a new instance initialized to the specified date where the date is specified in a string form.Creates a new instance initialized to the specified date where the date is specified in a String form and is parsed using the given pattern (also specified in String form).Creates a new instance initialized to the specified date where the date is specified in a String form and is parsed using the given pattern (also specified in String form).DfTime(String dateString, DateFormat format) Creates a new instance initialized to the specified date where the date is specified in a string form. -
Method Summary
Modifier and TypeMethodDescriptionReturns the date/time formatted according to the specified pattern.intReturns 1 if this date/time is later than the argument "time"; 0 if the two date/times are the same; or -1 if this date/time object represents an older time than the argument.booleanReturnstrueif the argument is a DfTime object that represents the same date/time as this object.final DategetDate()Returns the date as a Java Date.intgetDay()Returns the day portion of the date as an integer (e.g., 28).intgetHour()Returns the hour portion of the date as an integer.intReturns the minutes portion of the date as an integer.intgetMonth()Returns the month portion of the date as an integer (e.g., 12).Returns the pattern string used to format the date/time.intReturns the seconds portion of the date as an integer.intgetYear()Returns the year portion of the date as an integer (e.g., 1998).inthashCode()static booleanisKnownServerPattern(String pattern) Indicates whether the given date pattern is one of the known builtin server data patterns.final booleanIndicates whether this object represents a NULLDATE.booleanisValid()Indicates whether the underlying date string has a valid format.static booleanisValidPattern(String pattern) Indicates if the given date pattern is valid for use with DfTime.voidtoString()Returns the time string used to construct the DfTime object, or, if the DfTime object was constructed with a Java Date object, the result of formatting the date/time using DF_TIME_PATTERN_DEFAULT.static DfTimeReturns aDfTimewith a value represented by the specified String.void
-
Field Details
-
DF_NULLDATE_STR
- See Also:
-
DF_NULLDATE
-
DF_INVALIDDATE_STR
- See Also:
-
DF_INVALIDDATE
-
-
Constructor Details
-
DfTime
public DfTime()Creates a new DfTime object initialized to the current date. -
DfTime
-
DfTime
Creates a new instance initialized to the specified date where the date is specified in a string form. The default Java format for the current locale is used to parse the date string. -
DfTime
Creates a new instance initialized to the specified date where the date is specified in a String form and is parsed using the given pattern (also specified in String form). The date string is parsed using the given pattern. The pattern can be one of the pre-defined IDfTime patterns or a java date pattern, with the former taking precedence. It's highly recommended that if using a java pattern, use theDfTime(String, String, boolean)constructor. -
DfTime
Creates a new instance initialized to the specified date where the date is specified in a String form and is parsed using the given pattern (also specified in String form). The date string is parsed using the given pattern. IfinterpretAsJavaPatternOnlyis true then the given pattern is interpretted as a Java pattern; otherwise calling this constructor is equivalent to callingDfTime(String, String)which means the pattern could be either a Docbase date pattern or a Java date pattern.- Parameters:
dateString- The date string to parse.pattern- The pattern to use to parse the date string.interpretAsJavaPatternOnlyIgnored-- Since:
- 5.2
-
DfTime
Creates a new instance initialized to the specified date where the date is specified in a string form. The date string is parsed using the given format.
-
-
Method Details
-
valueOf
Returns aDfTimewith a value represented by the specified String.- Parameters:
string- a string.- Returns:
- the
DfTimevalue represented by the string.
-
isValidPattern
Indicates if the given date pattern is valid for use with DfTime.- Parameters:
pattern- The pattern to use to parse or format the date string.
-
compareTo
Description copied from interface:IDfTimeReturns 1 if this date/time is later than the argument "time"; 0 if the two date/times are the same; or -1 if this date/time object represents an older time than the argument. For the sake of this comparison, invalid times come before valid times so the result ofmyNullTime.compareTo(myInvalidTime)would be 1 (myNullTime is bigger). If both this DfTime object and the argument represent invalid times, 0 is returned. Otherwise, NULLDATEs always preceed any valid time. -
equals
Description copied from interface:IDfTimeReturnstrueif the argument is a DfTime object that represents the same date/time as this object. This method returnsfalseif the two date/times are different, if the argument is not of type DfTime, or if either this object or the argument does not represent a valid time. Note: This method returns a value of true if the method’s argument represents a time that is within one second of the time that the object represents. -
hashCode
public int hashCode() -
asString
Description copied from interface:IDfTimeReturns the date/time formatted according to the specified pattern. If this string was not returned from the server and if the pattern argument is not one of the 45 patterns defined in IDfTime, the string returned will be formatted using the default pattern. If the string was constructed on the client side and it was constructed with anullstring argument or the string "NULLDATE", returnsnull. -
toString
Description copied from interface:IDfTimeReturns the time string used to construct the DfTime object, or, if the DfTime object was constructed with a Java Date object, the result of formatting the date/time using DF_TIME_PATTERN_DEFAULT. -
getDate
Description copied from interface:IDfTimeReturns the date as a Java Date.- Specified by:
getDatein interfaceIDfTime- Returns:
- the date as a Java date. This will be
nullunder the following conditions: 1) the object was constructed with anulldate string or if that string equals "nullstring" (ignoring case); 2) the object was constructed with a date string that could not be parsed with the provided pattern string (or with the default pattern string if no pattern string was provided).
-
getDay
public int getDay()Description copied from interface:IDfTimeReturns the day portion of the date as an integer (e.g., 28). If the underlying date is a "nulldate", then 0 is returned. If the information is not contained in the time object (e.g. it was constructed with the year only: DfTime("1998", yyyy)), 1 is returned. -
getHour
public int getHour()Description copied from interface:IDfTimeReturns the hour portion of the date as an integer. If the underlying date is a "nulldate" or the DfTime object was created without time information, 0 is returned. -
getMinutes
public int getMinutes()Description copied from interface:IDfTimeReturns the minutes portion of the date as an integer. If the underlying date is a "nulldate" or the DfTime object was created without time information, 0 is returned.- Specified by:
getMinutesin interfaceIDfTime- Returns:
- the minutes portion of the date as an integer.
-
getMonth
public int getMonth()Description copied from interface:IDfTimeReturns the month portion of the date as an integer (e.g., 12). If the underlying date is a "nulldate", then 0 is returned. If the information is not contained in the time object (e.g. it was constructed with the year only: DfTime("1998", yyyy)), 1 is returned. -
getSeconds
public int getSeconds()Description copied from interface:IDfTimeReturns the seconds portion of the date as an integer. If the underlying date is a "nulldate" or the DfTime object was created without time information, 0 is returned.- Specified by:
getSecondsin interfaceIDfTime- Returns:
- the seconds portion of the date as an integer.
-
getYear
public int getYear()Description copied from interface:IDfTimeReturns the year portion of the date as an integer (e.g., 1998). If the underlying date is a "nulldate" or has an invalid format, then 0 is returned. -
isValid
public boolean isValid()Description copied from interface:IDfTimeIndicates whether the underlying date string has a valid format. There is some overhead connected with calling this method since it will attempt to parse the string if it has not done so already. -
isNullDate
public final boolean isNullDate()Description copied from interface:IDfTimeIndicates whether this object represents a NULLDATE.- Specified by:
isNullDatein interfaceIDfTime- Returns:
trueif the value of the DfTime object is "nulldate" or if the DfTime object was constructed with anullstring.
-
getPattern
Description copied from interface:IDfTimeReturns the pattern string used to format the date/time. If the constructor DfTime(String date, String pattern) was used to create this DfTime object, this method returns pattern argument passed to that constructor. If one of the other constructors was used, this method returns the pattern DF_TIME_PATTERN_DEFAULT.- Specified by:
getPatternin interfaceIDfTime- Returns:
- the pattern used to format this date/time.
-
isKnownServerPattern
Indicates whether the given date pattern is one of the known builtin server data patterns.- Parameters:
pattern- a data pattern string- Returns:
- an indication of whether the given date pattern is one of the known builtin server data patterns.
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-