Class Calendar

  • All Implemented Interfaces:
    Serializable, ComponentContainer<CalendarComponent>, PropertyContainer

    public class Calendar
    extends Object
    implements Serializable, PropertyContainer, ComponentContainer<CalendarComponent>
    $Id$ [Apr 5, 2004] 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..
     
    See Also:
    Serialized Form
    • Method Detail

      • 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:
        the PRODID property, or null if property doesn't exist
      • getVersion

        public final Version getVersion()
        Returns the mandatory version property.
        Returns:
        the VERSION property, or null if property doesn't exist
      • getCalendarScale

        public final CalScale getCalendarScale()
        Returns the optional calscale property.
        Returns:
        the CALSCALE property, or null if property doesn't exist
      • getMethod

        public final Method getMethod()
        Returns the optional method property.
        Returns:
        the METHOD property, or null if property doesn't exist
      • equals

        public final boolean equals​(Object arg0)
        Overrides:
        equals in class Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object