Package com.oss.asn1
Class ISO8601Date
java.lang.Object
com.oss.asn1.AbstractData
com.oss.asn1.AbstractISO8601Time
com.oss.asn1.ISO8601Date
- All Implemented Interfaces:
com.oss.asn1.Comparable
,ISO8601TimeInterface
,Serializable
,Cloneable
The ISO8601Date class represents the ASN.1 DATE 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
ConstructorsConstructorDescriptionThe default constructor.ISO8601Date
(int year, int month, int day) Constructs date value from year, month and day components.ISO8601Date
(String value) Constructs date value from a string. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears all the fields so they are set to UNDEFINED value.final boolean
equalTo
(ISO8601Date that) Compare 'this' object to another ISO8601Date object to see if their contents are the same.int
get
(int field) Get a field's value.final int
getDay()
Get the day component of 'this' object.final int
getMonth()
Get the month component of 'this' object.final int
getYear()
Get the year component of 'this' object.int
hashCode()
Returns a hash code for this objectvoid
set
(int field, int value) Set a field's value.final void
setDay
(int day) Set the day component of 'this' object.final void
setMonth
(int month) Set the month component of 'this' object.void
Set an instance of this class from a String containing value notation of the DATE.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
-
Constructor Details
-
ISO8601Date
public ISO8601Date()The default constructor. -
ISO8601Date
Constructs date value from a string. String should be in the "YYYY-MM-DD" format, whereYYYY
is a four-digit year,MM
is a two-digit month andDD
is a two-digit day number.- Parameters:
value
- a string containing date value.- Throws:
BadTimeFormatException
- ifvalue
has invalid format.
-
ISO8601Date
public ISO8601Date(int year, int month, int day) Constructs date value from year, month and day components.- Parameters:
year
- year valuemonth
- month valueday
- day value
-
-
Method Details
-
setValue
Set an instance of this class from a String containing value notation of the DATE.- Specified by:
setValue
in classAbstractISO8601Time
- Parameters:
value
- a string containing time value.- Throws:
BadTimeFormatException
- ifvalue
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.
-
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.
-
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
Compare 'this' object to another ISO8601Date object to see if their contents are the same.- Parameters:
that
- the ISO8601Date 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 classAbstractData
- Returns:
- a hash code for this object
-