Package com.oss.asn1

Class ISO8601DateTime

All Implemented Interfaces:
com.oss.asn1.Comparable, ISO8601TimeInterface, Serializable, Cloneable

public class ISO8601DateTime extends AbstractISO8601Time
The ISO8601DateTime class represents the ASN.1 DATE-TIME type
Since:
ASN.1/Java 4.0 Beta A
See Also:
  • Field Summary

    Fields inherited from class com.oss.asn1.AbstractData

    EQUALS, GREATER_THAN, LESS_THAN
  • Constructor Summary

    Constructors
    Constructor
    Description
    The default constructor.
    ISO8601DateTime(int year, int month, int day, int hour, int minute, int second)
    Constructs time of day value hour, minute and second components.
    Constructs time of day value from a string.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears all the fields so they are set to UNDEFINED value.
    final boolean
    Compare 'this' object to another ISO8601DateTime object to see if their contents are the same.
    int
    get(int field)
    Get a field's value.
    final int
    Get the day component of 'this' object.
    final int
    Get the hour component of 'this' object.
    final int
    Get the minute component of 'this' object.
    final int
    Get the month component of 'this' object.
    final int
    Get the second component of 'this' object.
    final int
    Get the year component of 'this' object.
    int
    Returns a hash code for this object
    void
    set(int field, int value)
    Set a field's value.
    final void
    setDay(int day)
    Set the day component of 'this' object.
    final void
    setHour(int hour)
    Set the hour component of 'this' object.
    final void
    setMinute(int minute)
    Set the minute component of 'this' object.
    final void
    setMonth(int month)
    Set the month component of 'this' object.
    final void
    setSecond(int second)
    Set the second component of 'this' object.
    void
    Set an instance of this class from a String containing value notation of the DATE-TIME.
    final void
    setYear(int year)
    Set the year component of 'this' object.

    Methods inherited from class com.oss.asn1.AbstractISO8601Time

    compareTo, compareTo, toDate, toDate

    Methods inherited from class com.oss.asn1.AbstractData

    clone, delete, equals, isEncodable, isPDU, isValid, toString, toString

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ISO8601DateTime

      public ISO8601DateTime()
      The default constructor.
    • ISO8601DateTime

      public ISO8601DateTime(String value) throws BadTimeFormatException
      Constructs time of day value from a string. String should be in the "YYYY-MM-DDTHH:MM:SS" format, where YYYY is a four-digit year, MM is a two-digit month, DD is a two-digit day number, HH is a two-digit hour, MM is a two-digit minute and SS is a two-digit second.
      Parameters:
      value - a string containing time of day value.
      Throws:
      BadTimeFormatException - if value has invalid format.
    • ISO8601DateTime

      public ISO8601DateTime(int year, int month, int day, int hour, int minute, int second)
      Constructs time of day value hour, minute and second components.
      Parameters:
      year - year value
      month - month value
      day - day value
      hour - hour value
      minute - minute value
      second - second value
  • Method Details

    • setValue

      public void setValue(String value) throws BadTimeFormatException
      Set an instance of this class from a String containing value notation of the DATE-TIME.
      Specified by:
      setValue in class AbstractISO8601Time
      Parameters:
      value - a string containing time value.
      Throws:
      BadTimeFormatException - if value has invalid format
    • getYear

      public final int getYear()
      Get the year component of 'this' object.
      Returns:
      int value indicating the year.
    • getMonth

      public final int getMonth()
      Get the month component of 'this' object.
      Returns:
      int value indicating the month.
    • getDay

      public final int getDay()
      Get the day component of 'this' object.
      Returns:
      int value indicating the day.
    • getHour

      public final int getHour()
      Get the hour component of 'this' object.
      Returns:
      int value indicating the hour.
    • getMinute

      public final int getMinute()
      Get the minute component of 'this' object.
      Returns:
      int value indicating the minute.
    • getSecond

      public final int getSecond()
      Get the second component of 'this' object.
      Returns:
      int value indicating the second.
    • setYear

      public final void setYear(int year)
      Set the year component of 'this' object.
      Parameters:
      year - the year to set.
    • setMonth

      public final void setMonth(int month)
      Set the month component of 'this' object.
      Parameters:
      month - the month to set.
    • setDay

      public final void setDay(int day)
      Set the day component of 'this' object.
      Parameters:
      day - the day to set.
    • setHour

      public final void setHour(int hour)
      Set the hour component of 'this' object.
      Parameters:
      hour - the hour to set.
    • setMinute

      public final void setMinute(int minute)
      Set the minute component of 'this' object.
      Parameters:
      minute - the minute to set.
    • setSecond

      public final void setSecond(int second)
      Set the second component of 'this' object.
      Parameters:
      second - the second to set.
    • get

      public int get(int field)
      Get a field's value.
      Parameters:
      field - field designator.
      Returns:
      field's value.
    • set

      public void set(int field, int value)
      Set a field's value.
      Parameters:
      field - field designator.
      value - field value.
    • clear

      public void clear()
      Clears all the fields so they are set to UNDEFINED value.
    • equalTo

      public final boolean equalTo(ISO8601DateTime that)
      Compare 'this' object to another ISO8601DateTime object to see if their contents are the same.
      Parameters:
      that - the ISO8601DateTime object to compare 'this' object to.
      Returns:
      true if contents of both objects are the same.
    • hashCode

      public int hashCode()
      Returns a hash code for this object
      Overrides:
      hashCode in class AbstractData
      Returns:
      a hash code for this object