|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectezvcard.util.PartialDate
public final class PartialDate
Represents a date in which some of the components are missing. This is used to represent reduced accuracy and truncated dates, as defined in ISO8601.
A truncated date is a date where the "lesser" components are missing. For example, "12:30" is truncated because the "seconds" component is missing.
PartialDate date = PartialDate.time(12, 30, null);
A reduced accuracy date is a date where the "greater" components are missing. For example, "April 20" is reduced accuracy because the "year" component is missing.
PartialDate date = PartialDate.date(null, 4, 20);
Constructor Summary | |
---|---|
PartialDate(Integer year,
Integer month,
Integer date,
Integer hour,
Integer minute,
Integer second,
UtcOffset offset)
Creates a new partial date. |
|
PartialDate(String string)
Parses a partial date from a string. |
Method Summary | |
---|---|
static PartialDate |
date(Integer year,
Integer month,
Integer date)
Creates a partial date containing only date components. |
static PartialDate |
dateTime(Integer year,
Integer month,
Integer date,
Integer hour,
Integer minute,
Integer second)
Creates a partial date containing date and time components, without a timezone. |
static PartialDate |
dateTime(Integer year,
Integer month,
Integer date,
Integer hour,
Integer minute,
Integer second,
UtcOffset offset)
Creates a partial date containing date and time components. |
boolean |
equals(Object obj)
|
Integer |
getDate()
Gets the date component. |
Integer |
getHour()
Gets the hour component. |
Integer |
getMinute()
Gets the minute component. |
Integer |
getMonth()
Gets the month component. |
Integer |
getSecond()
Gets the second component. |
Integer[] |
getTimezone()
Gets the timezone component. |
Integer |
getYear()
Gets the year component. |
boolean |
hasDateComponent()
Determines if there are any date components. |
int |
hashCode()
|
boolean |
hasTimeComponent()
Determines if there are any time components. |
static PartialDate |
time(Integer hour,
Integer minute,
Integer second)
Creates a partial date containing only time components. |
static PartialDate |
time(Integer hour,
Integer minute,
Integer second,
UtcOffset offset)
Creates a partial date containing only time components. |
String |
toDateAndOrTime(boolean extended)
Converts this partial date to its ISO 8601 representation. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PartialDate(Integer year, Integer month, Integer date, Integer hour, Integer minute, Integer second, UtcOffset offset)
Creates a new partial date.
The following combinations are not allowed and will result in an
IllegalArgumentException
being thrown:
year
- the year or null to excludemonth
- the month or null to excludedate
- the day of the month or null to excludehour
- the hour or null to excludeminute
- the minute or null to excludesecond
- the second or null to excludeoffset
- the UTC offset or null to exclude
IllegalArgumentException
- if an invalid combination is entered or
a component value is invalid (e.g. a negative minute)public PartialDate(String string)
string
- the string (e.g. "--0420T15")Method Detail |
---|
public static PartialDate date(Integer year, Integer month, Integer date)
Creates a partial date containing only date components.
The following combinations are not allowed and will result in an
IllegalArgumentException
being thrown:
year
- the year or null to excludemonth
- the month or null to excludedate
- the day of the month or null to exclude
IllegalArgumentException
- if an invalid combination is entered or
a component value is invalid (e.g. a negative month)public static PartialDate time(Integer hour, Integer minute, Integer second)
Creates a partial date containing only time components.
The following combinations are not allowed and will result in an
IllegalArgumentException
being thrown:
hour
- the hour or null to excludeminute
- the minute or null to excludesecond
- the second or null to exclude
IllegalArgumentException
- if an invalid combination is entered or
a component value is invalid (e.g. a negative minute)public static PartialDate time(Integer hour, Integer minute, Integer second, UtcOffset offset)
Creates a partial date containing only time components.
The following combinations are not allowed and will result in an
IllegalArgumentException
being thrown:
hour
- the hour or null to excludeminute
- the minute or null to excludesecond
- the second or null to excludeoffset
- the UTC offset or null to exclude
IllegalArgumentException
- if an invalid combination is entered or
a component value is invalid (e.g. a negative minute)public static PartialDate dateTime(Integer year, Integer month, Integer date, Integer hour, Integer minute, Integer second)
Creates a partial date containing date and time components, without a timezone.
The following combinations are not allowed and will result in an
IllegalArgumentException
being thrown:
year
- the year or null to excludemonth
- the month or null to excludedate
- the day of the month or null to excludehour
- the hour or null to excludeminute
- the minute or null to excludesecond
- the second or null to exclude
IllegalArgumentException
- if an invalid combination is entered or
a component value is invalid (e.g. a negative minute)public static PartialDate dateTime(Integer year, Integer month, Integer date, Integer hour, Integer minute, Integer second, UtcOffset offset)
Creates a partial date containing date and time components.
The following combinations are not allowed and will result in an
IllegalArgumentException
being thrown:
year
- the year or null to excludemonth
- the month or null to excludedate
- the day of the month or null to excludehour
- the hour or null to excludeminute
- the minute or null to excludesecond
- the second or null to excludeoffset
- the UTC offset or null to exclude
IllegalArgumentException
- if an invalid combination is entered or
a component value is invalid (e.g. a negative minute)public Integer getYear()
public Integer getMonth()
public Integer getDate()
public Integer getHour()
public Integer getMinute()
public Integer getSecond()
public Integer[] getTimezone()
public boolean hasDateComponent()
public boolean hasTimeComponent()
public String toDateAndOrTime(boolean extended)
extended
- true to use extended format, false to use basic
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |