Record Class RemoteEventsRead
- Record Components:
events- the occurrences that were read, each tagged with its calendar and colour; empty when the account could not be asked at allfailed- true when the account could not be asked, so the empty list above means "not read" rather than "nothing there"failedCalendars- hrefs of the collections that were listed but could not be read; empty when every listed calendar answered
A bare list of events cannot carry the one thing a client most needs to know. "This account holds no meeting this week" and "this account could not be reached" are both an empty array, and a caller that receives only the array has no way back to the distinction: it has to be told, or it will draw an empty week and call it the truth.
Two grains, because the failures come in two grains. failed says the
account itself could not be asked — the server was unreachable, or it
refused the stored credentials before any calendar was named — in which case
nothing at all was read and events is necessarily empty.
failedCalendars names the collections that were listed but could not
then be read; the account answered, the other calendars' events are in
events, and only the named ones are missing.
Partial answers are kept deliberately. Refusing the whole request when one collection of four fails would throw away three calendars' events to report the fourth, which is a worse agenda than the one the failure caused.
-
Constructor Summary
ConstructorsConstructorDescriptionRemoteEventsRead(List<RemoteIcsEvent> events, boolean failed, List<String> failedCalendars) Creates an instance of aRemoteEventsReadrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic RemoteEventsReadempty()The answer of an account that has nothing to say and no failure to report — most often one that is simply not connected.final booleanIndicates whether some other object is "equal to" this one.events()Returns the value of theeventsrecord component.booleanfailed()Returns the value of thefailedrecord component.Returns the value of thefailedCalendarsrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.static RemoteEventsReadThe answer of an account that could not be asked at all.
-
Constructor Details
-
RemoteEventsRead
Creates an instance of aRemoteEventsReadrecord class.- Parameters:
events- the value for theeventsrecord componentfailed- the value for thefailedrecord componentfailedCalendars- the value for thefailedCalendarsrecord component
-
-
Method Details
-
empty
The answer of an account that has nothing to say and no failure to report — most often one that is simply not connected.- Returns:
- an empty, unfailed reading
-
unreachable
The answer of an account that could not be asked at all.- Returns:
- an empty reading that says so
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
events
Returns the value of theeventsrecord component.- Returns:
- the value of the
eventsrecord component
-
failed
public boolean failed()Returns the value of thefailedrecord component.- Returns:
- the value of the
failedrecord component
-
failedCalendars
Returns the value of thefailedCalendarsrecord component.- Returns:
- the value of the
failedCalendarsrecord component
-