javax.time.calendar
Class DateResolvers

java.lang.Object
  extended by javax.time.calendar.DateResolvers

public final class DateResolvers
extends java.lang.Object

Provides common implementations of DateResolver.

This is a thread-safe utility class. All resolvers returned are immutable and thread-safe.

Author:
Michael Nascimento Santos, Stephen Colebourne

Method Summary
static DateResolver nextValid()
          Returns the next valid day resolver, which adjusts the date to be valid by moving to the first of the next month.
static DateResolver partLenient()
          Returns the part lenient resolver, which adjusts the date to be valid by moving it to the next month by the number of days that are invalid up to the 31st of the month.
static DateResolver previousValid()
          Returns the previous valid day resolver, which adjusts the date to be valid by moving to the last valid day of the month.
static DateResolver strict()
          Returns the strict resolver which does not manipulate the state in any way, resulting in an exception for all invalid values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

strict

public static DateResolver strict()
Returns the strict resolver which does not manipulate the state in any way, resulting in an exception for all invalid values.

The invalid input 2011-02-30 will throw an exception.
The invalid input 2012-02-30 will throw an exception (leap year).
The invalid input 2011-04-31 will throw an exception.

Returns:
the strict resolver, not null

previousValid

public static DateResolver previousValid()
Returns the previous valid day resolver, which adjusts the date to be valid by moving to the last valid day of the month.

The invalid input 2011-02-30 will return 2011-02-28.
The invalid input 2012-02-30 will return 2012-02-29 (leap year).
The invalid input 2011-04-31 will return 2011-04-30.

Returns:
the previous valid day resolver, not null

nextValid

public static DateResolver nextValid()
Returns the next valid day resolver, which adjusts the date to be valid by moving to the first of the next month.

The invalid input 2011-02-30 will return 2011-03-01.
The invalid input 2012-02-30 will return 2012-03-01 (leap year).
The invalid input 2011-04-31 will return 2011-05-01.

Returns:
the next valid day resolver, not null

partLenient

public static DateResolver partLenient()
Returns the part lenient resolver, which adjusts the date to be valid by moving it to the next month by the number of days that are invalid up to the 31st of the month.

The invalid input 2011-02-29 will return 2011-03-01.
The invalid input 2011-02-30 will return 2011-03-02.
The invalid input 2011-02-31 will return 2011-03-03.
The invalid input 2012-02-30 will return 2012-03-01 (leap year).
The invalid input 2012-02-31 will return 2012-03-02 (leap year).
The invalid input 2011-04-31 will return 2011-05-01.

Returns:
the part lenient resolver, not null