Version 4.10.0

hirondelle.web4j.model
Enum DateTime.DayOverflow

Object
  extended by Enum<DateTime.DayOverflow>
      extended by hirondelle.web4j.model.DateTime.DayOverflow
All Implemented Interfaces:
Serializable, Comparable<DateTime.DayOverflow>
Enclosing class:
DateTime

public static enum DateTime.DayOverflow
extends 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

LastDay

public static final DateTime.DayOverflow LastDay
Coerce the day to the last day of the month.


FirstDay

public static final DateTime.DayOverflow FirstDay
Coerce the day to the first day of the next month.


Spillover

public static final DateTime.DayOverflow Spillover
Spillover the day into the next month.


Abort

public static final DateTime.DayOverflow Abort
Throw a RuntimeException.

Method Detail

values

public static DateTime.DayOverflow[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (DateTime.DayOverflow c : DateTime.DayOverflow.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static DateTime.DayOverflow valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

Version 4.10.0

Copyright Hirondelle Systems. Published October 19, 2013 - User Guide - All Docs.