edu.cmu.andrew.icalendar
Class Property

java.lang.Object
  |
  +--edu.cmu.andrew.icalendar.Property
Direct Known Subclasses:
Transp, UnknownDate, UnknownDuration, UnknownInteger, UnknownProperty, UnknownString

public abstract class Property
extends Object


Field Summary
(package private)  Map parameters
          contains a map from parameter name -> List of Parameter objects
 
Constructor Summary
protected Property()
           
 
Method Summary
static Property getInstance(String name, String value, Map parameters)
          Create a Property object of the correct type for name.
abstract  String getName()
          Accessor for the name.
 List getParameter(String name)
          Given a name, return a List containing Parameter objects representing all of the parameters with this name.
abstract  String getValue()
          Accessor for the value.
abstract  boolean multipleOk()
          Returns whether or not multiple instances of these properties may appear in a single component.
 Writer output(Writer w)
          Write the iCalendar representation to w.
 String toString()
          Returns this Property in iCalendar form.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

parameters

Map parameters
contains a map from parameter name -> List of Parameter objects
Constructor Detail

Property

protected Property()
Method Detail

getParameter

public List getParameter(String name)
Given a name, return a List containing Parameter objects representing all of the parameters with this name.
Parameters:
name - the name of the parameters to return
Returns:
a List of Parameter objects, or the empty list.

getInstance

public static Property getInstance(String name,
                                   String value,
                                   Map parameters)
                            throws BadComponentException
Create a Property object of the correct type for name.
Parameters:
name - the name of the parameter
value - the String value of this parameter
Returns:
an instance of a subclass of Property
Throws:
BadComponentException - when value cannot be attached to name

multipleOk

public abstract boolean multipleOk()
Returns whether or not multiple instances of these properties may appear in a single component. The UnknownProperty class allows them, since some properties do so.
Returns:
true if this property may appear multiple times in a single component

getName

public abstract String getName()
Accessor for the name.
Returns:
the name of this property

getValue

public abstract String getValue()
Accessor for the value.
Returns:
the string form of the value of this property

output

public Writer output(Writer w)
              throws IOException
Write the iCalendar representation to w. It invokes the output method of each Parameter for this Property to correctly output this Property.
Parameters:
w - the writer to send output to
Returns:
the writer w
Throws:
IOException - when w does so

toString

public String toString()
Returns this Property in iCalendar form. This just invokes the output method, and using that method should be preferred.
Overrides:
toString in class Object
Returns:
a string representation of this object