src/net/fortuna/ical4j/model/property/RRule.java

Tue, 10 Feb 2015 19:58:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 10 Feb 2015 19:58:00 +0100
changeset 4
45d57ecba757
parent 0
fb9019fb1bf7
permissions
-rw-r--r--

Upgrade the upgraded ical4j component to use org.apache.commons.lang3.

michael@3 1 /**
michael@3 2 * Copyright (c) 2012, Ben Fortuna
michael@3 3 * All rights reserved.
michael@3 4 *
michael@3 5 * Redistribution and use in source and binary forms, with or without
michael@3 6 * modification, are permitted provided that the following conditions
michael@3 7 * are met:
michael@3 8 *
michael@3 9 * o Redistributions of source code must retain the above copyright
michael@3 10 * notice, this list of conditions and the following disclaimer.
michael@3 11 *
michael@3 12 * o Redistributions in binary form must reproduce the above copyright
michael@3 13 * notice, this list of conditions and the following disclaimer in the
michael@3 14 * documentation and/or other materials provided with the distribution.
michael@3 15 *
michael@3 16 * o Neither the name of Ben Fortuna nor the names of any other contributors
michael@3 17 * may be used to endorse or promote products derived from this software
michael@3 18 * without specific prior written permission.
michael@3 19 *
michael@3 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
michael@3 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
michael@3 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
michael@3 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
michael@3 24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
michael@3 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
michael@3 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
michael@3 27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
michael@3 28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
michael@3 29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
michael@3 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
michael@3 31 */
michael@3 32 package net.fortuna.ical4j.model.property;
michael@3 33
michael@3 34 import java.text.ParseException;
michael@3 35
michael@3 36 import net.fortuna.ical4j.model.ParameterList;
michael@3 37 import net.fortuna.ical4j.model.Property;
michael@3 38 import net.fortuna.ical4j.model.PropertyFactoryImpl;
michael@3 39 import net.fortuna.ical4j.model.Recur;
michael@3 40 import net.fortuna.ical4j.model.ValidationException;
michael@3 41
michael@3 42 /**
michael@3 43 * $Id$
michael@3 44 *
michael@3 45 * Created: [Apr 6, 2004]
michael@3 46 *
michael@3 47 * Defines an RRULE iCalendar component property.
michael@3 48 * @author benf
michael@3 49 */
michael@3 50 public class RRule extends Property {
michael@3 51
michael@3 52 private static final long serialVersionUID = -9188265089143001164L;
michael@3 53
michael@3 54 private Recur recur;
michael@3 55
michael@3 56 /**
michael@3 57 * Default constructor.
michael@3 58 */
michael@3 59 public RRule() {
michael@3 60 super(RRULE, PropertyFactoryImpl.getInstance());
michael@3 61 recur = new Recur(Recur.DAILY, 1);
michael@3 62 }
michael@3 63
michael@3 64 /**
michael@3 65 * @param value a rule string
michael@3 66 * @throws ParseException where the specified string is not a valid rule
michael@3 67 */
michael@3 68 public RRule(String value) throws ParseException {
michael@3 69 super(RRULE, PropertyFactoryImpl.getInstance());
michael@3 70 setValue(value);
michael@3 71 }
michael@3 72
michael@3 73 /**
michael@3 74 * @param aList a list of parameters for this component
michael@3 75 * @param aValue a value string for this component
michael@3 76 * @throws ParseException thrown when the specified string is not a valid representaton of a recurrence
michael@3 77 * @see Recur#Recur(String)
michael@3 78 */
michael@3 79 public RRule(final ParameterList aList, final String aValue)
michael@3 80 throws ParseException {
michael@3 81 super(RRULE, aList, PropertyFactoryImpl.getInstance());
michael@3 82 setValue(aValue);
michael@3 83 }
michael@3 84
michael@3 85 /**
michael@3 86 * @param aRecur a recurrence value
michael@3 87 */
michael@3 88 public RRule(final Recur aRecur) {
michael@3 89 super(RRULE, PropertyFactoryImpl.getInstance());
michael@3 90 recur = aRecur;
michael@3 91 }
michael@3 92
michael@3 93 /**
michael@3 94 * @param aList a list of parameters for this component
michael@3 95 * @param aRecur a recurrence value
michael@3 96 */
michael@3 97 public RRule(final ParameterList aList, final Recur aRecur) {
michael@3 98 super(RRULE, aList, PropertyFactoryImpl.getInstance());
michael@3 99 recur = aRecur;
michael@3 100 }
michael@3 101
michael@3 102 /**
michael@3 103 * @return Returns the recur.
michael@3 104 */
michael@3 105 public final Recur getRecur() {
michael@3 106 return recur;
michael@3 107 }
michael@3 108
michael@3 109 /**
michael@3 110 * {@inheritDoc}
michael@3 111 */
michael@3 112 public final void setValue(final String aValue) throws ParseException {
michael@3 113 recur = new Recur(aValue);
michael@3 114 }
michael@3 115
michael@3 116 /**
michael@3 117 * {@inheritDoc}
michael@3 118 */
michael@3 119 public final String getValue() {
michael@3 120 return getRecur().toString();
michael@3 121 }
michael@3 122
michael@3 123 /**
michael@3 124 * {@inheritDoc}
michael@3 125 */
michael@3 126 public final void validate() throws ValidationException {
michael@3 127 // TODO: Auto-generated method stub
michael@3 128 }
michael@3 129 }

mercurial