Package COM.activesw.api.client
Class BrokerDate
java.lang.Object
COM.activesw.api.client.BrokerDate
This class provides a powerful and flexible date/time system for use with the Java client API. It is intended to be used as a structure with publicly
accessible fields, but methods are also provided to set these fields.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty date.BrokerDate
(int yr, int mo, int dy) Create with the date set.BrokerDate
(int yr, int mo, int dy, int hr, int m, int s, int ms) Create with the date and time set.BrokerDate
(int yr, int mo, int dy, int hr, int m, int s, int ms, boolean normalize_time) Create with the date and time set.BrokerDate
(BrokerDate date) Copy constructor.BrokerDate
(String date_string) Create from date string using the a date or date/time formatter for the US English locale.BrokerDate
(String date_string, boolean normalize_time) Create from date string using the a date or date/time formatter for the US English locale.BrokerDate
(String date_string, Locale locale) Create from date string using a date/time formatter for the specified locale.BrokerDate
(String date_string, Locale locale, boolean normalize_time) Create from date string using a date/time formatter for the specified locale.BrokerDate
(Calendar calendar) Create using a Java Calendar.BrokerDate
(Calendar calendar, boolean normalize_time) Create using a Java Calendar.BrokerDate
(Date date) Create using a Java Date.BrokerDate
(Date date, boolean normalize_time) Create using a Java Date. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear the date entirely.void
Clear the time but leave the date intact.int
Compares to the given date.boolean
equals
(BrokerDate d) True if the date is equal to this one.Get the date as a Java Calendar object.Get the date as a Java Date object.boolean
isNull()
static String
static BrokerDate
Create a BrokerDate from a date string using a date or date/time formatter for the US English locale.static BrokerDate
Create a BrokerDate from a date string using a date or date/time formatter for the US English locale.static BrokerDate
Create a BrokerDate from a date string using a date or date/time formatter for the specified locale.static BrokerDate
Create a BrokerDate from a date string using a date or date/time formatter for the specified locale.static BrokerDate
parseLocalizedDate
(String date_string) Create a BrokerDate from a date string using a date or date/time formatter for the default locale.static BrokerDate
parseLocalizedDate
(String date_string, boolean normalize_time) Create a BrokerDate from a date string using a date or date/time formatter for the default locale.void
setDate
(int yr, int mo, int dy) Set the date only.void
setDateTime
(int yr, int mo, int dy, int hr, int m, int s, int ms) Set the date and time.void
setDateTime
(int yr, int mo, int dy, int hr, int m, int s, int ms, boolean normalize_time) Set the date and time.void
setJavaCalendar
(Calendar calendar) Set from a Java Calendar object.void
setJavaDate
(Date date) Set from a Java Date object.void
setJavaDate
(Date date, boolean normalize_time) Set from a Java Date object.void
setTime
(int hr, int m, int s, int ms) Set the time only.void
setTime
(int hr, int m, int s, int ms, boolean normalize_time) Set the time only.Return in a string format.toString()
Return in a string format.Return in a string format.
-
Field Details
-
rb
-
year
public int year -
month
public int month -
day
public int day -
hour
public int hour -
min
public int min -
sec
public int sec -
msec
public int msec -
is_date_and_time
public boolean is_date_and_timetrue if both date and time are represented. false if only a date is represented. -
is_utc
public boolean is_utctrue if the date and time are stored as UTC. Introduced with 6.0.
-
-
Constructor Details
-
BrokerDate
public BrokerDate()Create an empty date. 'is_date_and_time' is set to false. 'is_utc' is set to false. -
BrokerDate
public BrokerDate(int yr, int mo, int dy) Create with the date set. 'is_date_and_time' is set to false. 'is_utc' is set to false. -
BrokerDate
public BrokerDate(int yr, int mo, int dy, int hr, int m, int s, int ms) Create with the date and time set. 'is_date_and_time' is set to true. 'is_utc' is set to false. -
BrokerDate
public BrokerDate(int yr, int mo, int dy, int hr, int m, int s, int ms, boolean normalize_time) Create with the date and time set. 'is_date_and_time' is set to true. If 'normalize_time' is true, the time will be converted into the UTC timezone from the local timezone. If 'normalize_time' is set to false, the time supplied is already in the UTC timezone. The time will be marked 'is_utc'. -
BrokerDate
Create using a Java Calendar. 'is_date_and_time' is set to true. 'is_utc' is set if the Calendar passed in is equivalent to UTC. -
BrokerDate
Create using a Java Calendar. 'is_date_and_time' is set to true. If 'normalize_time' is true, the time will be converted into the UTC timezone from the local timezone. If 'normalize_time' is set to false, the time supplied is already in the UTC timezone. 'is_utc' is set to true. -
BrokerDate
Create using a Java Date. 'is_date_and_time' is set to true. 'is_utc' is set to false. -
BrokerDate
Create using a Java Date. 'is_date_and_time' is set to true. If 'normalize_time' is true, the time will be converted into the UTC timezone from the local timezone. If 'normalize_time' is set to false, the time supplied is already in the UTC timezone. 'is_utc' is set to true. -
BrokerDate
Copy constructor. -
BrokerDate
Create from date string using the a date or date/time formatter for the US English locale. The is_date_and_time flag will be set to true if minutes, seconds or milliseconds are all zero after parsing the script. On JDK versions 1.1.5 and earlier, JDK bugs result in some mis-parsed date values.- Throws:
ParseException
- If there is an error in the date string.
-
BrokerDate
Create from date string using the a date or date/time formatter for the US English locale. The is_date_and_time flag will be set to true if minutes, seconds or milliseconds are all zero after parsing the script. On JDK versions 1.1.5 and earlier, JDK bugs result in some mis-parsed date values.- Throws:
ParseException
- If there is an error in the date string.
-
BrokerDate
Create from date string using a date/time formatter for the specified locale. The is_date_and_time flag will be set to true if minutes, seconds or milliseconds are all zero after parsing the script. On JDK versions 1.1.5 and earlier, JDK bugs result in some mis-parsed date values. 'is_utc' will be set to false.- Throws:
ParseException
- If there is an error in the date string.
-
BrokerDate
Create from date string using a date/time formatter for the specified locale. The is_date_and_time flag will be set to true if minutes, seconds or milliseconds are all zero after parsing the script. On JDK versions 1.1.5 and earlier, JDK bugs result in some mis-parsed date values. If 'normalize_time' is true, the time will be converted into the UTC timezone from the local timezone. If 'normalize_time' is set to false, the time supplied is already in the UTC timezone. 'is_utc' will be set to true.- Throws:
ParseException
- If there is an error in the date string.
-
-
Method Details
-
parseDate
Create a BrokerDate from a date string using a date or date/time formatter for the US English locale. Same as date constructor that takes a string, except this method does not throw ParseException if the conversion fails. Instead it throws an IllegalArgumentException. 'is_utc' will be set to false.- Throws:
IllegalArgumentException
- If there is an error in the date string.
-
parseDate
Create a BrokerDate from a date string using a date or date/time formatter for the US English locale. Same as date constructor that takes a string, except this method does not throw ParseException if the conversion fails. Instead it throws an IllegalArgumentException. If 'normalize_time' is true, the time will be converted into the UTC timezone from the local timezone. If 'normalize_time' is set to false, the time supplied is already in the UTC timezone. 'is_utc' will be set to true.- Throws:
IllegalArgumentException
- If there is an error in the date string.
-
parseDate
Create a BrokerDate from a date string using a date or date/time formatter for the specified locale. Same as date constructor that takes a string, except this method does not throw ParseException if the conversion fails. Instead it throws an IllegalArgumentException. 'is_utc' will be set to false.- Throws:
IllegalArgumentException
- If there is an error in the date string.
-
parseDate
Create a BrokerDate from a date string using a date or date/time formatter for the specified locale. Same as date constructor that takes a string, except this method does not throw ParseException if the conversion fails. Instead it throws an IllegalArgumentException. If 'normalize_time' is true, the time will be converted into the UTC timezone from the local timezone. If 'normalize_time' is set to false, the time supplied is already in the UTC timezone. 'is_utc' will be set to true.- Throws:
IllegalArgumentException
- If there is an error in the date string.
-
parseLocalizedDate
Create a BrokerDate from a date string using a date or date/time formatter for the default locale. It is equivalent to calling parseDate(date_string, java.util.Locale.getDefault()). 'is_utc' will be set to false.- Throws:
IllegalArgumentException
- If there is an error in the date string.
-
parseLocalizedDate
Create a BrokerDate from a date string using a date or date/time formatter for the default locale. It is equivalent to calling parseDate(date_string, java.util.Locale.getDefault(), normalize_time). If 'normalize_time' is true, the time will be converted into the UTC timezone from the local timezone. If 'normalize_time' is set to false, the time supplied is already in the UTC timezone. 'is_utc' will be set to true.- Throws:
IllegalArgumentException
- If there is an error in the date string.
-
getJavaCalendar
Get the date as a Java Calendar object.- Throws:
BrokerOutOfRangeException
- If the date in this object cannot be represetned in a Java Calendar.BrokerException
-
getJavaDate
Get the date as a Java Date object. Milisecond accuracy is lost.- Throws:
BrokerOutOfRangeException
- If the date in this object cannot be represented in a Java Date.BrokerException
-
setDateTime
public void setDateTime(int yr, int mo, int dy, int hr, int m, int s, int ms) Set the date and time. 'is_date_and_time' is set to true. 'is_utc' is set to false. -
setDateTime
public void setDateTime(int yr, int mo, int dy, int hr, int m, int s, int ms, boolean normalize_time) Set the date and time. 'is_date_and_time' is set to true. If 'normalize_time' is true, the time will be converted into the UTC timezone from the local timezone. If 'normalize_time' is set to false, the time supplied is already in the UTC timezone. 'is_utc' is set to true. -
setDate
public void setDate(int yr, int mo, int dy) Set the date only. Does not set 'is_utc'. -
setTime
public void setTime(int hr, int m, int s, int ms) Set the time only. 'is_date_and_time' is set to true. Does not set 'is_utc'. -
setTime
Set the time only. 'is_date_and_time' is set to true. If 'normalize_time' is true, the time will be converted into the UTC timezone from the local timezone. If 'normalize_time' is set to false, the time supplied is already in the UTC timezone. 'is_utc' is set to true.- Throws:
BrokerException
-
setJavaCalendar
Set from a Java Calendar object. 'is_date_and_time' is set to true. Sets 'is_utc' based on Calendar object's timezone being UTC. -
setJavaDate
Set from a Java Date object. 'is_date_and_time' is set to true. 'is_utc' is set to false. -
setJavaDate
Set from a Java Date object. 'is_date_and_time' is set to true. If 'normalize_time' is true, the time will be converted into the UTC timezone from the local timezone. If 'normalize_time' is set to false, the time supplied is already in the UTC timezone. 'is_utc' is set to true. -
clear
public void clear()Clear the date entirely. 'is_date_and_time' is set to false. 'is_utc' is set to false. -
clearTime
public void clearTime()Clear the time but leave the date intact. 'is_date_and_time' is set to false. 'is_utc' is set to false if the resulting date isNull(). -
equals
True if the date is equal to this one. -
compareTo
Compares to the given date. Returns 0 if this date equals, -1 if this date is less than, and 1 if this date is greater than the given date. -
toString
Return in a string format. Uses the default date or date/time formatter for the specified locale. -
toString
Return in a string format. Uses the default date or date/time formatter for the US English locale. Equivalent totoString(java.util.Locale.US)
-
toLocalizedString
Return in a string format. Convenience method that uses the date or date/time formatter for the default locale. Equivalent totoString(java.util.Locale.getDefault())
. -
msg
-
isNull
public boolean isNull()
-