biweekly.property
Class DateOrDateTimeProperty

java.lang.Object
  extended by biweekly.property.ICalProperty
      extended by biweekly.property.DateOrDateTimeProperty
Direct Known Subclasses:
DateDue, DateEnd, DateStart, RecurrenceId

public class DateOrDateTimeProperty
extends ICalProperty

Represents a property whose value is a date or a date-time.

Author:
Michael Angstadt

Field Summary
protected  boolean hasTime
           
protected  boolean localTime
           
protected  DateTimeComponents rawComponents
           
protected  Date value
           
 
Fields inherited from class biweekly.property.ICalProperty
parameters
 
Constructor Summary
DateOrDateTimeProperty(Date value, boolean hasTime)
          Creates a new property.
DateOrDateTimeProperty(DateTimeComponents rawComponents)
          Creates a new property.
 
Method Summary
 DateTimeComponents getRawComponents()
          Gets the raw components of the date-time value.
 String getTimezoneId()
          Gets the timezone identifier.
 Date getValue()
          Gets the date-time value.
 boolean hasTime()
          Determines whether the date-time value has a time component.
 boolean isLocalTime()
          Gets whether the date should be outputted in local time (without a timezone).
 void setLocalTime(boolean localTime)
          Sets whether the date should be outputted in local time (without a timezone).
 void setRawComponents(DateTimeComponents rawComponents)
          Sets the raw components of the date-time value.
 void setTimezone(VTimezone timezone)
          Sets the property's timezone to a timezone that is defined within the iCalendar object.
 void setTimezoneId(String timezoneId)
          Sets the timezone identifier.
 void setValue(Date value, boolean hasTime)
          Sets the date-time value.
protected  void validate(List<ICalComponent> components, List<String> warnings)
          Checks the property for data consistency problems or deviations from the spec.
 
Methods inherited from class biweekly.property.ICalProperty
addParameter, getParameter, getParameters, getParameters, removeParameter, setParameter, setParameter, setParameters, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

protected Date value

rawComponents

protected DateTimeComponents rawComponents

hasTime

protected boolean hasTime

localTime

protected boolean localTime
Constructor Detail

DateOrDateTimeProperty

public DateOrDateTimeProperty(DateTimeComponents rawComponents)
Creates a new property.

Parameters:
rawComponents - the raw components of the date-time value

DateOrDateTimeProperty

public DateOrDateTimeProperty(Date value,
                              boolean hasTime)
Creates a new property.

Parameters:
value - the date-time value
hasTime - true if the value has a time component, false if it is strictly a date
Method Detail

getValue

public Date getValue()
Gets the date-time value.

Returns:
the date-time value

setValue

public void setValue(Date value,
                     boolean hasTime)
Sets the date-time value.

Parameters:
value - the date-time value
hasTime - true if the value has a time component, false if it is strictly a date

getRawComponents

public DateTimeComponents getRawComponents()
Gets the raw components of the date-time value.

Returns:
the raw components

setRawComponents

public void setRawComponents(DateTimeComponents rawComponents)
Sets the raw components of the date-time value.

Parameters:
rawComponents - the raw components

hasTime

public boolean hasTime()
Determines whether the date-time value has a time component.

Returns:
true if the value has a time component, false if it is strictly a date

isLocalTime

public boolean isLocalTime()
Gets whether the date should be outputted in local time (without a timezone).

Returns:
true to output the date without a timezone, false to include a timezone

setLocalTime

public void setLocalTime(boolean localTime)
Sets whether the date should be outputted in local time (without a timezone). Use setTimezoneId(String) to specify a timezone. Dates are written in UTC time by default.

Parameters:
localTime - true to output the date without a timezone, false to include a timezone (defaults to false)

getTimezoneId

public String getTimezoneId()
Description copied from class: ICalProperty
Gets the timezone identifier. This either (a) references the TimezoneId property of a VTimezone component, or (b) specifies a globally-defined timezone (e.g. "America/New_York"). For a list of globally-defined timezones, see the TZ database.

Returns:
the timezone identifier or null if not set

setTimezoneId

public void setTimezoneId(String timezoneId)
Description copied from class: ICalProperty
Sets the timezone identifier. This either (a) references the TimezoneId property of a VTimezone component, or (b) specifies a globally-defined timezone (e.g. "America/New_York"). For a list of globally-defined timezones, see the TZ database.

Parameters:
timezoneId - the timezone identifier (e.g. "America/New_York") or null to remove

setTimezone

public void setTimezone(VTimezone timezone)
Description copied from class: ICalProperty
Sets the property's timezone to a timezone that is defined within the iCalendar object. Use ICalProperty.setTimezoneId(String) to use a globally-defined timezone (e.g. "America/New_York").

Parameters:
timezone - the timezone component to reference or null to remove

validate

protected void validate(List<ICalComponent> components,
                        List<String> warnings)
Description copied from class: ICalProperty
Checks the property for data consistency problems or deviations from the spec. Meant to be overridden by child classes that wish to provide validation logic.

Overrides:
validate in class ICalProperty
Parameters:
components - the hierarchy of components that the property belongs to
warnings - the list to add the warnings to


Copyright © 2013 Michael Angstadt. All Rights Reserved.