|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
Object Enum<DateTime.DayOverflow> hirondelle.web4j.model.DateTime.DayOverflow
public static enum DateTime.DayOverflow
Policy for treating 'day-of-the-month overflow' conditions encountered during some date calculations.
Months are different from other units of time, since the length of a month is not fixed, but rather varies with both month and year. This leads to problems. Take the following simple calculation, for example :
May 31 + 1 month = ?
What's the answer? Since there is no such thing as June 31, the result of this operation is inherently ambiguous. This DayOverflow enumeration lists the various policies for treating such situations, as supported by DateTime.
This table illustrates how the policies behave :
Date | DayOverflow | Result |
---|---|---|
May 31 + 1 Month | LastDay | June 30 |
May 31 + 1 Month | FirstDay | July 1 |
December 31, 2001 + 2 Months | Spillover | March 3 |
May 31 + 1 Month | Abort | RuntimeException |
Enum Constant Summary | |
---|---|
Abort
Throw a RuntimeException. |
|
FirstDay
Coerce the day to the first day of the next month. |
|
LastDay
Coerce the day to the last day of the month. |
|
Spillover
Spillover the day into the next month. |
Method Summary | |
---|---|
static DateTime.DayOverflow |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static DateTime.DayOverflow[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final DateTime.DayOverflow LastDay
public static final DateTime.DayOverflow FirstDay
public static final DateTime.DayOverflow Spillover
public static final DateTime.DayOverflow Abort
Method Detail |
---|
public static DateTime.DayOverflow[] values()
for (DateTime.DayOverflow c : DateTime.DayOverflow.values()) System.out.println(c);
public static DateTime.DayOverflow valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is null
|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |