Enum Class Leniency

java.lang.Object
java.lang.Enum<Leniency>
net.time4j.format.Leniency
All Implemented Interfaces:
Serializable, Comparable<Leniency>, java.lang.constant.Constable

public enum Leniency extends Enum<Leniency>

Defines how lenient parsing of chronological texts should be.

Author:
Meno Hochschild
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The parsed data will be interpreted without any consistency check or validation of range limits.
    This default mode tries to be a compromise between a pedantic and a lax strategy by paying attention to value range constraints but neglecting some constraints like the width of numerical elements.
    Ensures that all range limits and other validity constraints will be strictly controlled.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Is this leniency mode lax?
    boolean
    Is this leniency mode smart?
    boolean
    Is this leniency mode strict?
    static Leniency
    valueOf​(String name)
    Returns the enum constant of this class with the specified name.
    static Leniency[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Enum

    compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • STRICT

      public static final Leniency STRICT

      Ensures that all range limits and other validity constraints will be strictly controlled.

      Exceeding the possibly context-dependent range of an element value will always throw an exception.

      A consistency check will be performed, too. That means all parsed informations must be consistent (for example the right weekday for a given calendar date). In parsing, the given limits for minimum and maximum count of chars to be interpreted will be checked, too.

    • SMART

      public static final Leniency SMART

      This default mode tries to be a compromise between a pedantic and a lax strategy by paying attention to value range constraints but neglecting some constraints like the width of numerical elements.

      There is no consistency check like in strict mode. For example a wrong weekday will be ignored and the calendar date will just be interpreted on the base of year, month and day of month.

    • LAX

      public static final Leniency LAX

      The parsed data will be interpreted without any consistency check or validation of range limits.

      This mode even tolerates values like the wall time "T25:00" or the invalid calendar date "2014-02-31" which will be interpreted with the suitable day overflow as "2014-03-03".

  • Method Details

    • values

      public static Leniency[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Leniency valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • isStrict

      public boolean isStrict()

      Is this leniency mode strict?

      Returns:
      boolean
    • isSmart

      public boolean isSmart()

      Is this leniency mode smart?

      Returns:
      boolean
    • isLax

      public boolean isLax()

      Is this leniency mode lax?

      Returns:
      boolean