public class OrderValidityDate extends Object
ActivationDate
and ExpirationDate
that represents a date for an order.Modifier and Type | Field and Description |
---|---|
protected static Pattern |
DATE_PATTERN |
protected String |
dateStr |
protected Date |
datetime |
protected boolean |
isLocal |
static String |
LOCAL |
protected String |
location |
protected String |
offset |
protected String |
timeStr |
static String |
ZEROED_OFFSET |
Constructor and Description |
---|
OrderValidityDate() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getDateAsString()
Gets the date as a string in the format "YYYYMMDD".
|
Date |
getDateTime()
Deprecated.
The Date object returned by this method is created by parsing the date and time passed in to the
parse(String, String, String, String) method, without taking the offset or location parameters into account.
Because of this limitation, the Date object returned by this method is not a true representation of this instance
of OrderValidityDate, and this method has been deprecated accordingly. Client code should use the methods
getDateAsString() , getTimeAsString() , getLocation() and getOffset() instead. |
String |
getLocation()
Gets the location that the date and time relate to.
|
String |
getOffset()
Gets the UTC offset for the time, in the format "[+-][0-9]{2}:[0-9]{2}", e.g "+01:00".
|
String |
getTimeAsString()
Gets the time as a string in the format "HH:MM:SS".
|
int |
hashCode() |
boolean |
isLocal()
Returns a boolean indicating whether this date and time were specified as local to the user, in which
case a UTC offset should also be present and can be retrieved by calling
getOffset() , or if
the date and time relate to a specific location in which case no offset needs to be provided. |
protected void |
parse(String dateStr,
String timeStr,
String location,
String offset)
Sets the date, time, location and offset values from the parameters.
|
String |
toString() |
public static final String LOCAL
public static final String ZEROED_OFFSET
protected static final Pattern DATE_PATTERN
protected String dateStr
protected String timeStr
protected String location
protected String offset
protected Date datetime
protected boolean isLocal
protected void parse(String dateStr, String timeStr, String location, String offset) throws OrderConfigurationException
dateStr
- A date in the format "YYYYMMDD".timeStr
- A time in the format "HH:MM:SS".location
- A location, which can be a place such as "London" or the string "LOCAL". If a location is provided, it is not necessary
(or permitted) to provide an offset because it can be inferred from the date, time and location.offset
- A timezone offset in the format "[+-][0-9]{2}:[0-9]{2}", e.g "+01:00".OrderConfigurationException
- If:
@Deprecated public Date getDateTime()
parse(String, String, String, String)
method, without taking the offset or location parameters into account.
Because of this limitation, the Date object returned by this method is not a true representation of this instance
of OrderValidityDate, and this method has been deprecated accordingly. Client code should use the methods
getDateAsString()
, getTimeAsString()
, getLocation()
and getOffset()
instead.Date
.public String getDateAsString()
public String getTimeAsString()
public String getLocation()
public String getOffset()
public boolean isLocal()
getOffset()
, or if
the date and time relate to a specific location in which case no offset needs to be provided.Copyright © 2015 Caplin Systems.