public class

LenientDateTimeField

extends DelegatedDateTimeField
java.lang.Object
   ↳ org.joda.time.DateTimeField
     ↳ org.joda.time.field.DelegatedDateTimeField
       ↳ org.joda.time.field.LenientDateTimeField

Class Overview

Converts a strict DateTimeField into a lenient one. By being lenient, the set method accepts out of bounds values, performing an addition instead.

LenientDateTimeField is thread-safe and immutable.

Summary

Protected Constructors
LenientDateTimeField(DateTimeField field, Chronology base)
Public Methods
static DateTimeField getInstance(DateTimeField field, Chronology base)
Returns a lenient version of the given field.
final boolean isLenient()
Returns true if the set method is lenient.
long set(long instant, int value)
Set values which may be out of bounds by adding the difference between the new value and the current value.
[Expand]
Inherited Methods
From class org.joda.time.field.DelegatedDateTimeField
From class org.joda.time.DateTimeField
From class java.lang.Object

Protected Constructors

protected LenientDateTimeField (DateTimeField field, Chronology base)

Public Methods

public static DateTimeField getInstance (DateTimeField field, Chronology base)

Returns a lenient version of the given field. If it is already lenient, then it is returned as-is. Otherwise, a new LenientDateTimeField is returned.

public final boolean isLenient ()

Returns true if the set method is lenient. If so, it accepts values that are out of bounds. For example, a lenient day of month field accepts 32 for January, converting it to February 1.

Returns
  • true if this field is lenient

public long set (long instant, int value)

Set values which may be out of bounds by adding the difference between the new value and the current value.

Parameters
instant the milliseconds from 1970-01-01T00:00:00Z to set in
value the value to set, in the units of the field
Returns
  • the updated milliseconds