javax.time.calendar
Interface Calendrical

All Known Implementing Classes:
AmPmOfDay, Chronology, ChronologyDate, CopticChronology, CopticDate, CopticStandardChronology, DateTimeField, DateTimeFields, DayOfWeek, GregorianCalendar, HijrahChronology, HijrahDate, HijrahEra, HistoricChronology, HistoricDate, HistoricEra, ISOChronology, JapaneseChronology, JapaneseDate, JapaneseEra, JulianChronology, LocalDate, LocalDateTime, LocalTime, MinguoChronology, MinguoDate, MinguoEra, MonthDay, MonthOfYear, OffsetDate, OffsetDateTime, OffsetTime, QuarterOfYear, StandardChronology, ThaiBuddhistChronology, ThaiBuddhistDate, ThaiBuddhistEra, Year, YearMonth, ZonedDateTime, ZoneId, ZoneOffset

public interface Calendrical

Provides access in a uniform way to calendrical values.

All classes that can provide calendrical information should implement this interface. The single method allows a calendrical to be queried to find the value of a rule. A calendrical might be a single field, such as month-of-year or hour-of-day, or a whole object, such as LocalDate or ZoneOffset.

This interface makes no guarantees about the thread-safety or immutability of implementations.

Author:
Stephen Colebourne

Method Summary
<T> T
get(CalendricalRule<T> rule)
          Gets the value of the specified calendrical rule.
 

Method Detail

get

<T> T get(CalendricalRule<T> rule)
Gets the value of the specified calendrical rule.

This method queries the value of the specified rule. If the rule is not supported then null will be returned.

Where this method returns numeric values, Integer is the preferred type. The values should be within the range of the field wherever possible. For example, minute-of-hour should be from 0 to 59 inclusive. The calling code must validate the value however and not trust it to be valid.

The standard implementation of this method calls one of the static derive methods on CalendricalEngine.

Implementations must ensure that calls to this method are thread-safe. An immutable implementation will naturally provide this guarantee.

Parameters:
rule - the rule to query, not null
Returns:
the value for the rule, null if no value for the rule