biweekly.property.marshaller
Class ICalPropertyMarshaller.DateParser

java.lang.Object
  extended by biweekly.property.marshaller.ICalPropertyMarshaller.DateParser
Enclosing class:
ICalPropertyMarshaller<T extends ICalProperty>

protected static class ICalPropertyMarshaller.DateParser
extends Object

Factory class for parsing dates.


Constructor Summary
ICalPropertyMarshaller.DateParser(String value)
          Creates a new date writer object.
 
Method Summary
 Date parse()
          Parses the date string.
 ICalPropertyMarshaller.DateParser tz(TimeZone timezone)
          Sets the timezone to parse the date as.
 ICalPropertyMarshaller.DateParser tzid(String timezoneId)
          Sets the ID of the timezone to parse the date as (TZID parameter value).
 ICalPropertyMarshaller.DateParser tzid(String timezoneId, List<String> warnings)
          Sets the ID of the timezone to parse the date as (TZID parameter value).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ICalPropertyMarshaller.DateParser

public ICalPropertyMarshaller.DateParser(String value)
Creates a new date writer object.

Parameters:
value - the date string to parse
Method Detail

tzid

public ICalPropertyMarshaller.DateParser tzid(String timezoneId)
Sets the ID of the timezone to parse the date as (TZID parameter value). If the ID does not contain a "/" character, it will be ignored.

Parameters:
timezoneId - the timezone ID
Returns:
this

tzid

public ICalPropertyMarshaller.DateParser tzid(String timezoneId,
                                              List<String> warnings)
Sets the ID of the timezone to parse the date as (TZID parameter value).

Parameters:
timezoneId - the timezone ID. If the ID is global (contains a "/" character), it will attempt to look up the timezone in Java's timezone registry and parse the date according to that timezone. If the timezone is not found, the date will be parsed according to the JVM's default timezone and a warning message will be added to the provided warnings list. If the ID is not global, it will be parsed according to the JVM's default timezone. Whichever timezone is chosen here, it will be ignored if the date string is in UTC time or contains an offset.
warnings - if the ID is global and is not recognized, a warning message will be added to this list
Returns:
this

tz

public ICalPropertyMarshaller.DateParser tz(TimeZone timezone)
Sets the timezone to parse the date as.

Parameters:
timezone - the timezone
Returns:
this

parse

public Date parse()
Parses the date string.

Returns:
the parsed date
Throws:
IllegalArgumentException - if the date string is invalid


Copyright © 2013 Michael Angstadt. All Rights Reserved.