Package javax.time.calendar
Class CalendricalContext
- java.lang.Object
-
- javax.time.calendar.CalendricalContext
-
- All Implemented Interfaces:
java.io.Serializable
public final class CalendricalContext extends java.lang.Object implements java.io.Serializable
Context for aspects of date-time calculations that frequently change.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
checkUnusedFields
Whether to check unused fields.private DateResolver
dateResolver
Whether to use a date resolver for resolving dates.private static long
serialVersionUID
Serialization version.private boolean
strict
Whether to use strict rules.
-
Constructor Summary
Constructors Constructor Description CalendricalContext(boolean strict, boolean checkUnusedFields)
Constructs an instance that can merge the specified calendrical.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Is this context equal to the specified context.DateResolver
getDateResolver()
Gets the date resolver to use.int
hashCode()
A hashcode for this context.boolean
isCheckUnusedFields()
Checks whether to check unused fields.boolean
isStrict()
Checks whether calculations will use strict rules or not.LocalDate
resolveDate(int year, int month, int dayOfMonth)
Resolves the year, month and day-of-month to a date using ISO chronology rules.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serialization version.- See Also:
- Constant Field Values
-
strict
private final boolean strict
Whether to use strict rules.
-
dateResolver
private final DateResolver dateResolver
Whether to use a date resolver for resolving dates.
-
checkUnusedFields
private final boolean checkUnusedFields
Whether to check unused fields.
-
-
Method Detail
-
isStrict
public boolean isStrict()
Checks whether calculations will use strict rules or not.- Returns:
- true if calculations will use strict rules
-
isCheckUnusedFields
public boolean isCheckUnusedFields()
Checks whether to check unused fields.- Returns:
- true if unused fields will be checked
-
getDateResolver
public DateResolver getDateResolver()
Gets the date resolver to use.- Returns:
- the date resolver to use
-
resolveDate
public LocalDate resolveDate(int year, int month, int dayOfMonth)
Resolves the year, month and day-of-month to a date using ISO chronology rules.The three input parameters are resolved to a date. If the context specifies a date resolver, then that is used. Otherwise, the strict/lenient flag is used.
- Parameters:
year
- the year to resolvemonth
- the month to resolvedayOfMonth
- the day-of-month to resolve- Returns:
- the resolved date, never null
- Throws:
IllegalCalendarFieldValueException
- if one of the fields has an invalid valueCalendricalException
- if the input date does not match the stored date
-
equals
public boolean equals(java.lang.Object obj)
Is this context equal to the specified context.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the other context to compare to, null returns false- Returns:
- true if this instance is equal to the specified context
-
hashCode
public int hashCode()
A hashcode for this context.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a suitable hashcode
-
-