Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.fortuna.ical4j.model
Class Calendar

    java.lang.Object
      net.fortuna.ical4j.model.Calendar

All Implemented Interfaces:
  Serializable

    public class Calendar

extends Object
implements Serializable

Defines an iCalendar calendar.

       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.getProperties().add(new ProdId("-//Ben Fortuna//iCal4j 1.0//EN"));
     calendar.getProperties().add(Version.VERSION_2_0);
     calendar.getProperties().add(CalScale.GREGORIAN);

     // Add events, etc..

Author:
  Ben Fortuna
See Also:
  Serialized Form

Field Summary
`static String` | `BEGIN`
`static String` | `END`
`static String` | `VCALENDAR`

Constructor Summary
`Calendar()` Default constructor.
`Calendar(ComponentList components)` Constructs a new calendar with no properties and the specified components.
`Calendar(PropertyList p, ComponentList c)` Constructor.

Method Summary
`boolean` | `equals(Object arg0)` Uses `ObjectUtils` to test equality.
`CalScale` | `getCalendarScale()` Returns the optional calscale property.
`Component` | `getComponent(String name)` Convenience method for retrieving a named component.
`ComponentList` | `getComponents()`
`ComponentList` | `getComponents(String name)` Convenience method for retrieving a list of named components.
`Method` | `getMethod()` Returns the optional method property.
`ProdId` | `getProductId()` Returns the mandatory prodid property.
`PropertyList` | `getProperties()`
`PropertyList` | `getProperties(String name)` Convenience method for retrieving a list of named properties.
`Property` | `getProperty(String name)` Convenience method for retrieving a named property.
`Version` | `getVersion()` Returns the mandatory version property.
`int` | `hashCode()` Uses `HashCodeBuilder` to build hashcode.
`String` | `toString()`
`void` | `validate()` Perform validation on the calendar, its properties and its components in its current state.
`void` | `validate(boolean recurse)` Perform validation on the calendar in its current state.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### BEGIN

    public static final String BEGIN

See Also:
  Constant Field Values

### VCALENDAR

    public static final String VCALENDAR

See Also:
  Constant Field Values

### END

    public static final String END

See Also:
  Constant Field Values

Constructor Detail

### Calendar

    public Calendar()

  Default constructor.

### Calendar

    public Calendar(ComponentList components)

  Constructs a new calendar with no properties and the specified components.

  Parameters:
    `components` - a list of components to add to the calendar

### Calendar

    public Calendar(PropertyList p,
                    ComponentList c)

  Constructor.

  Parameters:
    `p` - a list of properties
    `c` - a list of components

Method Detail

### toString

    public final String toString()

  Overrides:
    `toString` in class `Object`
  See Also:
    `Object.toString()`

### getComponents

    public final ComponentList getComponents()

  Returns:
    Returns the components.

### getComponents

    public final ComponentList getComponents(String name)

  Convenience method for retrieving a list of named components.

  Parameters:
    `name` - name of components to retrieve
  Returns:
    a component list containing only components with the specified name

### getComponent

    public final Component getComponent(String name)

  Convenience method for retrieving a named component.

  Parameters:
    `name` - name of the component to retrieve
  Returns:
    the first matching component in the component list with the specified name

### getProperties

    public final PropertyList getProperties()

  Returns:
    Returns the properties.

### getProperties

    public final PropertyList getProperties(String name)

  Convenience method for retrieving a list of named properties.

  Parameters:
    `name` - name of properties to retrieve
  Returns:
    a property list containing only properties with the specified name

### getProperty

    public final Property getProperty(String name)

  Convenience method for retrieving a named property.

  Parameters:
    `name` - name of the property to retrieve
  Returns:
    the first matching property in the property list with the specified name

### validate

    public final void validate()
                        throws ValidationException

  Perform validation on the calendar, its properties and its components in its current state.

  Throws:
    `ValidationException` - where the calendar is not in a valid state

### validate

    public void validate(boolean recurse)
                  throws ValidationException

  Perform validation on the calendar in its current state.

  Parameters:
    `recurse` - indicates whether to validate the calendar's properties and components
  Throws:
    `ValidationException` - where the calendar is not in a valid state

### getProductId

    public final ProdId getProductId()

  Returns the mandatory prodid property.

  Returns:

### getVersion

    public final Version getVersion()

  Returns the mandatory version property.

  Returns:

### getCalendarScale

    public final CalScale getCalendarScale()

  Returns the optional calscale property.

  Returns:

### getMethod

    public final Method getMethod()

  Returns the optional method property.

  Returns:

### equals

    public final boolean equals(Object arg0)

  Uses `ObjectUtils` to test equality. Two calendars are equal if and only if their property lists and component lists are equal.

  Overrides:
    `equals` in class `Object`

### hashCode

    public final int hashCode()

  Uses `HashCodeBuilder` to build hashcode.

  Overrides:
    `hashCode` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2007 Modularity. All Rights Reserved.