webMethods Broker Administration Java API
Version 9.5.1.0.171 091713

COM.activesw.api.client
Class BrokerDate

java.lang.Object
  extended by COM.activesw.api.client.BrokerDate

public class BrokerDate
extends java.lang.Object

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
 int day
           
 int hour
           
 boolean is_date_and_time
          true if both date and time are represented.
 boolean is_utc
          true if the date and time are stored as UTC.
 int min
           
 int month
           
 int msec
           
protected static java.util.ResourceBundle rb
           
 int sec
           
 int year
           
 
Constructor Summary
BrokerDate()
          Create an empty date.
BrokerDate(BrokerDate date)
          Copy constructor.
BrokerDate(java.util.Calendar calendar)
          Create using a Java Calendar.
BrokerDate(java.util.Calendar calendar, boolean normalize_time)
          Create using a Java Calendar.
BrokerDate(java.util.Date date)
          Create using a Java Date.
BrokerDate(java.util.Date date, boolean normalize_time)
          Create using a Java 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(java.lang.String date_string)
          Create from date string using the a date or date/time formatter for the US English locale.
BrokerDate(java.lang.String date_string, boolean normalize_time)
          Create from date string using the a date or date/time formatter for the US English locale.
BrokerDate(java.lang.String date_string, java.util.Locale locale)
          Create from date string using a date/time formatter for the specified locale.
BrokerDate(java.lang.String date_string, java.util.Locale locale, boolean normalize_time)
          Create from date string using a date/time formatter for the specified locale.
 
Method Summary
 void clear()
          Clear the date entirely.
 void clearTime()
          Clear the time but leave the date intact.
 int compareTo(BrokerDate d)
          Compares to the given date.
 boolean equals(BrokerDate d)
          True if the date is equal to this one.
 java.util.Calendar getJavaCalendar()
          Get the date as a Java Calendar object.
 java.util.Date getJavaDate()
          Get the date as a Java Date object.
 boolean isNull()
           
static java.lang.String msg(java.lang.String key, java.lang.String arg1)
           
static BrokerDate parseDate(java.lang.String date_string)
          Create a BrokerDate from a date string using a date or date/time formatter for the US English locale.
static BrokerDate parseDate(java.lang.String date_string, boolean normalize_time)
          Create a BrokerDate from a date string using a date or date/time formatter for the US English locale.
static BrokerDate parseDate(java.lang.String date_string, java.util.Locale locale)
          Create a BrokerDate from a date string using a date or date/time formatter for the specified locale.
static BrokerDate parseDate(java.lang.String date_string, java.util.Locale locale, boolean normalize_time)
          Create a BrokerDate from a date string using a date or date/time formatter for the specified locale.
static BrokerDate parseLocalizedDate(java.lang.String date_string)
          Create a BrokerDate from a date string using a date or date/time formatter for the default locale.
static BrokerDate parseLocalizedDate(java.lang.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(java.util.Calendar calendar)
          Set from a Java Calendar object.
 void setJavaDate(java.util.Date date)
          Set from a Java Date object.
 void setJavaDate(java.util.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.
 java.lang.String toLocalizedString()
          Return in a string format.
 java.lang.String toString()
          Return in a string format.
 java.lang.String toString(java.util.Locale locale)
          Return in a string format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rb

protected static final java.util.ResourceBundle 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_time
true if both date and time are represented. false if only a date is represented.


is_utc

public boolean is_utc
true if the date and time are stored as UTC. Introduced with 6.0.

Constructor Detail

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

public BrokerDate(java.util.Calendar calendar)
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

public BrokerDate(java.util.Calendar calendar,
                  boolean normalize_time)
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

public BrokerDate(java.util.Date date)
Create using a Java Date. 'is_date_and_time' is set to true. 'is_utc' is set to false.


BrokerDate

public BrokerDate(java.util.Date date,
                  boolean normalize_time)
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

public BrokerDate(BrokerDate date)
Copy constructor.


BrokerDate

public BrokerDate(java.lang.String date_string)
           throws java.text.ParseException
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:
java.text.ParseException - If there is an error in the date string.

BrokerDate

public BrokerDate(java.lang.String date_string,
                  boolean normalize_time)
           throws java.text.ParseException
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:
java.text.ParseException - If there is an error in the date string.

BrokerDate

public BrokerDate(java.lang.String date_string,
                  java.util.Locale locale)
           throws java.text.ParseException
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:
java.text.ParseException - If there is an error in the date string.

BrokerDate

public BrokerDate(java.lang.String date_string,
                  java.util.Locale locale,
                  boolean normalize_time)
           throws java.text.ParseException
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:
java.text.ParseException - If there is an error in the date string.
Method Detail

parseDate

public static BrokerDate parseDate(java.lang.String date_string)
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:
java.lang.IllegalArgumentException - If there is an error in the date string.

parseDate

public static BrokerDate parseDate(java.lang.String date_string,
                                   boolean normalize_time)
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:
java.lang.IllegalArgumentException - If there is an error in the date string.

parseDate

public static BrokerDate parseDate(java.lang.String date_string,
                                   java.util.Locale locale)
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:
java.lang.IllegalArgumentException - If there is an error in the date string.

parseDate

public static BrokerDate parseDate(java.lang.String date_string,
                                   java.util.Locale locale,
                                   boolean normalize_time)
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:
java.lang.IllegalArgumentException - If there is an error in the date string.

parseLocalizedDate

public static BrokerDate parseLocalizedDate(java.lang.String date_string)
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:
java.lang.IllegalArgumentException - If there is an error in the date string.

parseLocalizedDate

public static BrokerDate parseLocalizedDate(java.lang.String date_string,
                                            boolean normalize_time)
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:
java.lang.IllegalArgumentException - If there is an error in the date string.

getJavaCalendar

public java.util.Calendar getJavaCalendar()
                                   throws BrokerException
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

public java.util.Date getJavaDate()
                           throws BrokerException
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

public void setTime(int hr,
                    int m,
                    int s,
                    int ms,
                    boolean normalize_time)
             throws BrokerException
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

public void setJavaCalendar(java.util.Calendar calendar)
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

public void setJavaDate(java.util.Date date)
Set from a Java Date object. 'is_date_and_time' is set to true. 'is_utc' is set to false.


setJavaDate

public void setJavaDate(java.util.Date date,
                        boolean normalize_time)
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

public boolean equals(BrokerDate d)
True if the date is equal to this one.


compareTo

public int compareTo(BrokerDate d)
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

public java.lang.String toString(java.util.Locale locale)
Return in a string format. Uses the default date or date/time formatter for the specified locale.


toString

public java.lang.String toString()
Return in a string format. Uses the default date or date/time formatter for the US English locale. Equivalent to toString(java.util.Locale.US)

Overrides:
toString in class java.lang.Object

toLocalizedString

public java.lang.String toLocalizedString()
Return in a string format. Convenience method that uses the date or date/time formatter for the default locale. Equivalent to toString(java.util.Locale.getDefault()).


msg

public static java.lang.String msg(java.lang.String key,
                                   java.lang.String arg1)

isNull

public boolean isNull()

webMethods Broker Administration Java API
Version 9.5.1.0.171 091713


Copyright © 2001 - 2013 Software AG Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, United States of America, and/or their suppliers.