Class StrictDateTimeField

  • All Implemented Interfaces:

    public class StrictDateTimeField
    extends DelegatedDateTimeField
    Converts a lenient DateTimeField into a strict one. By being strict, the set throws an IllegalArgumentException if the value is out of bounds.

    StrictDateTimeField is thread-safe and immutable.

    See Also:
    StrictChronology, LenientDateTimeField, Serialized Form
    • Method Detail

      • getInstance

        public static DateTimeField getInstance​(DateTimeField field)
        Returns a strict version of the given field. If it is already strict, then it is returned as-is. Otherwise, a new StrictDateTimeField is returned.
      • isLenient

        public final boolean isLenient()
        Description copied from class: DateTimeField
        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.
        isLenient in class DelegatedDateTimeField
        true if this field is lenient
      • set

        public long set​(long instant,
                        int value)
        Does a bounds check before setting the value.
        set in class DelegatedDateTimeField
        instant - the milliseconds from 1970-01-01T00:00:00Z to set in
        value - the value to set, in the units of the field
        the updated milliseconds
        java.lang.IllegalArgumentException - if the value is invalid