1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package net.fortuna.ical4j.model.property;
35
36 import java.text.ParseException;
37
38 import net.fortuna.ical4j.model.DateList;
39 import net.fortuna.ical4j.model.Parameter;
40 import net.fortuna.ical4j.model.ParameterList;
41 import net.fortuna.ical4j.model.Property;
42 import net.fortuna.ical4j.model.ValidationException;
43 import net.fortuna.ical4j.model.parameter.Value;
44 import net.fortuna.ical4j.util.ParameterValidator;
45
46 /***
47 * Defines a EXDATE iCalendar component property.
48 *
49 * @author benf
50 */
51 public class ExDate extends Property {
52
53 private DateList dates;
54
55 /***
56 * @param aList
57 * a list of parameters for this component
58 * @param aValue
59 * a value string for this component
60 * @throws ParseException
61 * where the specified value string is not a valid
62 * date-time/date representation
63 */
64 public ExDate(final ParameterList aList, final String aValue)
65 throws ParseException {
66 this(aList, new DateList(aValue, (Value) aList
67 .getParameter(Parameter.VALUE)));
68 }
69
70 /***
71 * @param aList
72 * a list of parameters for this component
73 * @param dList
74 * a list of dates
75 */
76 public ExDate(final ParameterList aList, final DateList dList) {
77 super(EXDATE, aList);
78
79 dates = dList;
80 }
81
82 /***
83 * @return Returns the dates.
84 */
85 public final DateList getDates() {
86 return dates;
87 }
88
89 /***
90 * @see net.fortuna.ical4j.model.Property#validate()
91 */
92 public final void validate() throws ValidationException {
93
94
95
96
97
98
99 ParameterValidator.getInstance().validateOneOrLess(Parameter.VALUE,
100 getParameters());
101
102 Parameter valueParam = getParameters().getParameter(Parameter.VALUE);
103
104 if (valueParam != null
105 && !Value.DATE_TIME.equals(valueParam.getValue())
106 && !Value.DATE.equals(valueParam.getValue())) { throw new ValidationException(
107 "Parameter [" + Parameter.VALUE + "] is invalid"); }
108
109 ParameterValidator.getInstance().validateOneOrLess(Parameter.TZID,
110 getParameters());
111
112
113
114
115
116
117 }
118
119
120
121
122
123
124 public String getValue() {
125 return getDates().toString();
126 }
127 }