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 Details

  • Constructor Details

    • DfTime

      public DfTime()
      Creates a new DfTime object initialized to the current date.
    • DfTime

      public DfTime(Date date)
    • DfTime

      public DfTime(String dateString)
      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

      public DfTime(String dateString, String pattern)
      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 the DfTime(String, String, boolean) constructor.

    • DfTime

      public DfTime(String dateString, String pattern, boolean interpretAsJavaPatternOnlyIgnored)
      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. If interpretAsJavaPatternOnly is true then the given pattern is interpretted as a Java pattern; otherwise calling this constructor is equivalent to calling DfTime(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

      public DfTime(String dateString, DateFormat format)
      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

      public static DfTime valueOf(String string)
      Returns a DfTime with a value represented by the specified String.
      Parameters:
      string - a string.
      Returns:
      the DfTime value represented by the string.
    • isValidPattern

      public static boolean isValidPattern(String pattern)
      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

      public int compareTo(IDfTime object)
      Description copied from interface: IDfTime
      Returns 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 of myNullTime.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.
      Specified by:
      compareTo in interface IDfTime
      Parameters:
      object - a DfTime object
      Returns:
      return 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.
    • equals

      public boolean equals(Object o)
      Description copied from interface: IDfTime
      Returns true if the argument is a DfTime object that represents the same date/time as this object. This method returns false if 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.
      Specified by:
      equals in interface IDfTime
      Overrides:
      equals in class Object
      Parameters:
      o - a DfTime object
      Returns:
      true if argument is a DfTime object that represents the same date/time as this object.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • asString

      public String asString(String pattern)
      Description copied from interface: IDfTime
      Returns 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 a null string argument or the string "NULLDATE", returns null.
      Specified by:
      asString in interface IDfTime
      Parameters:
      pattern - a Documentum date/time pattern string. See the comments for the constructor DfTime(String, String). for a listing of the legal patterns.
      Returns:
      the date formatted
    • toString

      public String toString()
      Description copied from interface: IDfTime
      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.
      Specified by:
      toString in interface IDfTime
      Overrides:
      toString in class Object
      Returns:
      the internal time string.
    • getDate

      public final Date getDate()
      Description copied from interface: IDfTime
      Returns the date as a Java Date.
      Specified by:
      getDate in interface IDfTime
      Returns:
      the date as a Java date. This will be null under the following conditions: 1) the object was constructed with a null date 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: IDfTime
      Returns 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.
      Specified by:
      getDay in interface IDfTime
      Returns:
      the day portion of the date as an integer.
    • getHour

      public int getHour()
      Description copied from interface: IDfTime
      Returns 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.
      Specified by:
      getHour in interface IDfTime
      Returns:
      the hour portion of the date as an integer.
    • getMinutes

      public int getMinutes()
      Description copied from interface: IDfTime
      Returns 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:
      getMinutes in interface IDfTime
      Returns:
      the minutes portion of the date as an integer.
    • getMonth

      public int getMonth()
      Description copied from interface: IDfTime
      Returns 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.
      Specified by:
      getMonth in interface IDfTime
      Returns:
      the month portion of the date as an integer.
    • getSeconds

      public int getSeconds()
      Description copied from interface: IDfTime
      Returns 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:
      getSeconds in interface IDfTime
      Returns:
      the seconds portion of the date as an integer.
    • getYear

      public int getYear()
      Description copied from interface: IDfTime
      Returns 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.
      Specified by:
      getYear in interface IDfTime
      Returns:
      the year portion of the date as an integer.
    • isValid

      public boolean isValid()
      Description copied from interface: IDfTime
      Indicates 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.
      Specified by:
      isValid in interface IDfTime
      Returns:
      true if this contains a valid date/time string.
    • isNullDate

      public final boolean isNullDate()
      Description copied from interface: IDfTime
      Indicates whether this object represents a NULLDATE.
      Specified by:
      isNullDate in interface IDfTime
      Returns:
      true if the value of the DfTime object is "nulldate" or if the DfTime object was constructed with a null string.
    • getPattern

      public String getPattern()
      Description copied from interface: IDfTime
      Returns 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:
      getPattern in interface IDfTime
      Returns:
      the pattern used to format this date/time.
    • isKnownServerPattern

      public static boolean isKnownServerPattern(String pattern)
      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

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException