4.6 Calendar Components
The body of the iCalendar object consists of a sequence of calendar
properties and one or more calendar components. The calendar
properties are attributes that apply to the calendar as a whole. The
calendar components are collections of properties that express a
particular calendar semantic. For example, the calendar component can
specify an event, a to-do, a journal entry, time zone information, or
free/busy time information, or an alarm.
The body of the iCalendar object is defined by the following
notation:
icalbody = calprops component
calprops = 2*(
; 'prodid' and 'version' are both REQUIRED,
; but MUST NOT occur more than once
prodid /version /
; 'calscale' and 'method' are optional,
; but MUST NOT occur more than once
calscale /
method /
x-prop
)
component = 1*(eventc / todoc / journalc / freebusyc /
/ timezonec / iana-comp / x-comp)
iana-comp = "BEGIN" ":" iana-token CRLF
1*contentline
"END" ":" iana-token CRLF
x-comp = "BEGIN" ":" x-name CRLF
1*contentline
"END" ":" x-name CRLF
Example 1 - Creating a new calendar:
Calendar calendar = new Calendar();
calendar.add(new ProdId("-//Ben Fortuna//iCal4j 1.0//EN"));
calendar.add(Version.VERSION_2_0);
calendar.add(CalScale.GREGORIAN);
// Add events, etc..
| Modifier and Type | Field and Description |
|---|---|
| public static final String | BEGIN
Begin token. |
| private ComponentList | |
| public static final String | END
End token. |
| public static final BiFunction | |
| public static final BiFunction | MERGE_PROPERTIES
Smart merging of properties that identifies whether to add or replace existing properties. |
| private PropertyList | |
| private static final long | |
| private final Validator | |
| public static final String | VCALENDAR
Calendar token. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | Calendar(final ComponentList<? extends CalendarComponent>
a list of components to add to the calendar components)Constructs a new calendar with no properties and the specified components. |
| public | Calendar(PropertyList
a list of initial calendar properties properties, ComponentList<? extends CalendarComponent> a list of initial calendar components components)Initialise a Calendar object using the default configured validator. |
| public | Calendar(PropertyList
a list of properties p, ComponentList<? extends CalendarComponent> a list of components c, Validator<Calendar> used to ensure the validity of the calendar instance validator)Constructor. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final Calendar | Returns: a new calendar instance that protects against mutation of the source calendarImplements net. Creates a deep copy of the calendar. |
| public final boolean | equals(final Object
the reference object with which to compare. arg0)Overrides java. Indicates whether some other object is "equal to" this one. |
| public final ComponentList | Returns: Returns the underlying component list.Implements net.
|
| public <C extends CalendarComponent> List | |
| public String | Returns: a content type stringan optional encoding charset)Returns an appropriate MIME Content-Type for the calendar object instance. |
| public Calendar | |
| public <T extends Property> List | |
| public final PropertyList | Returns: Returns the underlying property list.Implements net.
|
| public Uid | Returns: the UID propertyReturns a unique identifier as specified by components in the calendar instance. |
| public final int | |
| public Calendar | |
| public void | setComponentList(ComponentList<CalendarComponent> components)
Implements net.
|
| public void | setPropertyList(PropertyList properties)
Implements net.
|
| public Calendar[] | Returns: an array of calendar objectsSplits a calendar object into distinct calendar objects for unique identifiers (UID). |
| public final String | |
| public ValidationResult | validate()
Perform validation on the calendar, its properties and its components in its current state. |
| public ValidationResult | validate(final boolean
indicates whether to validate the calendar's properties and components recurse)Perform validation on the calendar in its current state. |
| private ValidationResult | |
| private ValidationResult |
| BEGIN | back to summary |
|---|---|
| public static final String BEGIN Begin token. | |
| components | back to summary |
|---|---|
| private ComponentList<CalendarComponent> components | |
| END | back to summary |
|---|---|
| public static final String END End token. | |
| MERGE_COMPONENTS | back to summary |
|---|---|
| public static final BiFunction<Calendar, List<CalendarComponent>, Calendar> MERGE_COMPONENTS | |
| MERGE_PROPERTIES | back to summary |
|---|---|
| public static final BiFunction<Calendar, List<Property>, Calendar> MERGE_PROPERTIES Smart merging of properties that identifies whether to add or replace existing properties. | |
| properties | back to summary |
|---|---|
| private PropertyList properties | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| validator | back to summary |
|---|---|
| private final Validator<Calendar> validator | |
| VCALENDAR | back to summary |
|---|---|
| public static final String VCALENDAR Calendar token. | |
| Calendar | back to summary |
|---|---|
| public Calendar() Default constructor. | |
| Calendar | back to summary |
|---|---|
| public Calendar(final ComponentList<? extends CalendarComponent> components) Constructs a new calendar with no properties and the specified components.
| |
| Calendar | back to summary |
|---|---|
| public Calendar(PropertyList properties, ComponentList<? extends CalendarComponent> components) Initialise a Calendar object using the default configured validator.
| |
| Calendar | back to summary |
|---|---|
| public Calendar(PropertyList p, ComponentList<? extends CalendarComponent> c, Validator<Calendar> validator) Constructor.
| |
| Calendar | back to summary |
|---|---|
| public Calendar(Calendar c) Creates a shallow copy of the specified calendar.
| |
| copy | back to summary |
|---|---|
| public final Calendar copy() Implements net. Creates a deep copy of the calendar.
| |
| equals | back to summary |
|---|---|
| public final boolean equals(final Object arg0) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getComponentList | back to summary |
|---|---|
| public final ComponentList Implements net.
| |
| getComponents | back to summary |
|---|---|
| public <C extends CalendarComponent> List | |
| getContentType | back to summary |
|---|---|
| public String getContentType(Charset charset) Returns an appropriate MIME Content-Type for the calendar object instance. | |
| getFluentTarget | back to summary |
|---|---|
| public Calendar getFluentTarget() Implements net.
| |
| getProperties | back to summary |
|---|---|
| public <T extends Property> List Explicitly override due to conflict with groovy implicit method.. | |
| getPropertyList | back to summary |
|---|---|
| public final PropertyList getPropertyList() Implements net.
| |
| getUid | back to summary |
|---|---|
| public Uid getUid() throws ConstraintViolationException Returns a unique identifier as specified by components in the calendar instance.
| |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| merge | back to summary |
|---|---|
| public Calendar merge(final Calendar c2) Merge all properties and components from the specified calendar with this instance. Note that the merge process is not very sophisticated, and may result in invalid calendar data (e.g. multiple properties of a type that should only be specified once). | |
| setComponentList | back to summary |
|---|---|
| public void setComponentList(ComponentList<CalendarComponent> components) Implements net.
| |
| setPropertyList | back to summary |
|---|---|
| public void setPropertyList(PropertyList properties) Implements net.
| |
| split | back to summary |
|---|---|
| public Calendar[] split() Splits a calendar object into distinct calendar objects for unique identifiers (UID).
| |
| toString | back to summary |
|---|---|
| public final String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| validate | back to summary |
|---|---|
| public ValidationResult validate() throws ValidationException Perform validation on the calendar, its properties and its components in its current state.
| |
| validate | back to summary |
|---|---|
| public ValidationResult validate(final boolean recurse) throws ValidationException Perform validation on the calendar in its current state.
| |
| validateComponents | back to summary |
|---|---|
| private ValidationResult validateComponents() throws ValidationException Invoke validation on the calendar components in its current state.
| |
| validateProperties | back to summary |
|---|---|
| private ValidationResult validateProperties() throws ValidationException Invoke validation on the calendar properties in its current state.
| |