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

Thu, 12 Feb 2015 18:02:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 12 Feb 2015 18:02:00 +0100
changeset 14
5ae3e5665a0b
parent 0
fb9019fb1bf7
permissions
-rw-r--r--

Record important information about gradle build configuration tracking.

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 net.fortuna.ical4j.model.TextList;
michael@3 35 import net.fortuna.ical4j.model.Parameter;
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.ValidationException;
michael@3 40 import net.fortuna.ical4j.util.ParameterValidator;
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 a CATEGORIES iCalendar component property.
michael@3 48 * <pre>
michael@3 49 * 4.8.1.2 Categories
michael@3 50 *
michael@3 51 * Property Name: CATEGORIES
michael@3 52 *
michael@3 53 * Purpose: This property defines the categories for a calendar
michael@3 54 * component.
michael@3 55 *
michael@3 56 * Value Type: TEXT
michael@3 57 *
michael@3 58 * Property Parameters: Non-standard and language property parameters
michael@3 59 * can be specified on this property.
michael@3 60 *
michael@3 61 * Conformance: The property can be specified within "VEVENT", "VTODO"
michael@3 62 * or "VJOURNAL" calendar components.
michael@3 63 *
michael@3 64 * Description: This property is used to specify categories or subtypes
michael@3 65 * of the calendar component. The categories are useful in searching for
michael@3 66 * a calendar component of a particular type and category. Within the
michael@3 67 * "VEVENT", "VTODO" or "VJOURNAL" calendar components, more than one
michael@3 68 * category can be specified as a list of categories separated by the
michael@3 69 * COMMA character (US-ASCII decimal 44).
michael@3 70 *
michael@3 71 * Format Definition: The property is defined by the following notation:
michael@3 72 *
michael@3 73 * categories = "CATEGORIES" catparam ":" text *("," text)
michael@3 74 * CRLF
michael@3 75 *
michael@3 76 * catparam = *(
michael@3 77 *
michael@3 78 * ; the following is optional,
michael@3 79 * ; but MUST NOT occur more than once
michael@3 80 *
michael@3 81 * (";" languageparam ) /
michael@3 82 *
michael@3 83 * ; the following is optional,
michael@3 84 * ; and MAY occur more than once
michael@3 85 *
michael@3 86 * (";" xparam)
michael@3 87 *
michael@3 88 * )
michael@3 89 * </pre>
michael@3 90 * @author benf
michael@3 91 */
michael@3 92 public class Categories extends Property {
michael@3 93
michael@3 94 private static final long serialVersionUID = -7769987073466681634L;
michael@3 95
michael@3 96 private TextList categories;
michael@3 97
michael@3 98 /**
michael@3 99 * Default constructor.
michael@3 100 */
michael@3 101 public Categories() {
michael@3 102 super(CATEGORIES, PropertyFactoryImpl.getInstance());
michael@3 103 categories = new TextList();
michael@3 104 }
michael@3 105
michael@3 106 /**
michael@3 107 * @param aValue a value string for this component
michael@3 108 */
michael@3 109 public Categories(final String aValue) {
michael@3 110 super(CATEGORIES, PropertyFactoryImpl.getInstance());
michael@3 111 setValue(aValue);
michael@3 112 }
michael@3 113
michael@3 114 /**
michael@3 115 * @param aList a list of parameters for this component
michael@3 116 * @param aValue a value string for this component
michael@3 117 */
michael@3 118 public Categories(final ParameterList aList, final String aValue) {
michael@3 119 super(CATEGORIES, aList, PropertyFactoryImpl.getInstance());
michael@3 120 setValue(aValue);
michael@3 121 }
michael@3 122
michael@3 123 /**
michael@3 124 * @param cList a list of categories
michael@3 125 */
michael@3 126 public Categories(final TextList cList) {
michael@3 127 super(CATEGORIES, PropertyFactoryImpl.getInstance());
michael@3 128 categories = cList;
michael@3 129 }
michael@3 130
michael@3 131 /**
michael@3 132 * @param aList a list of parameters for this component
michael@3 133 * @param cList a list of categories
michael@3 134 */
michael@3 135 public Categories(final ParameterList aList, final TextList cList) {
michael@3 136 super(CATEGORIES, aList, PropertyFactoryImpl.getInstance());
michael@3 137 categories = cList;
michael@3 138 }
michael@3 139
michael@3 140 /**
michael@3 141 * {@inheritDoc}
michael@3 142 */
michael@3 143 public final void setValue(final String aValue) {
michael@3 144 categories = new TextList(aValue);
michael@3 145 }
michael@3 146
michael@3 147 /**
michael@3 148 * {@inheritDoc}
michael@3 149 */
michael@3 150 public final void validate() throws ValidationException {
michael@3 151
michael@3 152 /*
michael@3 153 * ; the following is optional, ; but MUST NOT occur more than once (";" languageparam ) /
michael@3 154 */
michael@3 155 ParameterValidator.getInstance().assertOneOrLess(Parameter.LANGUAGE,
michael@3 156 getParameters());
michael@3 157
michael@3 158 /*
michael@3 159 * ; the following is optional, ; and MAY occur more than once (";" xparam)
michael@3 160 */
michael@3 161 }
michael@3 162
michael@3 163 /**
michael@3 164 * @return Returns the categories.
michael@3 165 */
michael@3 166 public final TextList getCategories() {
michael@3 167 return categories;
michael@3 168 }
michael@3 169
michael@3 170 /**
michael@3 171 * {@inheritDoc}
michael@3 172 */
michael@3 173 public final String getValue() {
michael@3 174 return getCategories().toString();
michael@3 175 }
michael@3 176 }

mercurial