javax.time.calendrical
Interface CalendricalObject

All Superinterfaces:
CalendricalAdjuster
All Known Subinterfaces:
DateTimeCalendrical, DateTimeObject
All Known Implementing Classes:
AmPm, Calendar, ChronoDate, Date, DateTimeBuilder, DayOfWeek, GregorianCalendar, Instant, LocalDate, LocalDateTime, LocalTime, Month, MonthDay, OffsetDate, OffsetDateTime, OffsetTime, QuarterOfYear, Year, YearMonth, ZonedDateTime, ZoneId, ZoneOffset

public interface CalendricalObject
extends CalendricalAdjuster

An object that represents some form of calendrical information.

Implementation notes

This interface places no restrictions on implementations and makes no guarantees about their thread-safety.


Method Summary
<T> T
extract(java.lang.Class<T> type)
          Extracts an instance of the specified type.
 CalendricalObject with(CalendricalAdjuster calendrical)
          Returns a copy of this calendrical with the specified calendrical set.
 

Method Detail

extract

<T> T extract(java.lang.Class<T> type)
Extracts an instance of the specified type.

An implementation must return the following types if it contains sufficient information:

Other objects may be returned if appropriate.

Type Parameters:
T - the type to extract
Parameters:
type - the type to extract, null returns null
Returns:
the extracted object, null if unable to extract

with

CalendricalObject with(CalendricalAdjuster calendrical)
Returns a copy of this calendrical with the specified calendrical set.

This allows the manipulation of a calendrical in a general way. For example, if this calendrical is a LocalDateTime and the specified calendrical is a LocalDate, then the implementation will return a new LocalDateTime with the date changed.

An implementation must handle the following types if possible:

Parameters:
calendrical - the calendrical to set into this calendrical, null returns null
Returns:
a copy of this calendrical with the specified calendrical set, not null
Throws:
CalendricalException - if unable to set the calendrical into this calendrical