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

changeset 3
73bdfa70b04e
parent 0
fb9019fb1bf7
     1.1 --- a/src/net/fortuna/ical4j/model/property/Categories.java	Tue Feb 10 19:25:00 2015 +0100
     1.2 +++ b/src/net/fortuna/ical4j/model/property/Categories.java	Tue Feb 10 19:38:00 2015 +0100
     1.3 @@ -1,176 +1,176 @@
     1.4 -/**
     1.5 - * Copyright (c) 2012, Ben Fortuna
     1.6 - * All rights reserved.
     1.7 - *
     1.8 - * Redistribution and use in source and binary forms, with or without
     1.9 - * modification, are permitted provided that the following conditions
    1.10 - * are met:
    1.11 - *
    1.12 - *  o Redistributions of source code must retain the above copyright
    1.13 - * notice, this list of conditions and the following disclaimer.
    1.14 - *
    1.15 - *  o Redistributions in binary form must reproduce the above copyright
    1.16 - * notice, this list of conditions and the following disclaimer in the
    1.17 - * documentation and/or other materials provided with the distribution.
    1.18 - *
    1.19 - *  o Neither the name of Ben Fortuna nor the names of any other contributors
    1.20 - * may be used to endorse or promote products derived from this software
    1.21 - * without specific prior written permission.
    1.22 - *
    1.23 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1.24 - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    1.25 - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    1.26 - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    1.27 - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    1.28 - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    1.29 - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    1.30 - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    1.31 - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    1.32 - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    1.33 - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.34 - */
    1.35 -package net.fortuna.ical4j.model.property;
    1.36 -
    1.37 -import net.fortuna.ical4j.model.TextList;
    1.38 -import net.fortuna.ical4j.model.Parameter;
    1.39 -import net.fortuna.ical4j.model.ParameterList;
    1.40 -import net.fortuna.ical4j.model.Property;
    1.41 -import net.fortuna.ical4j.model.PropertyFactoryImpl;
    1.42 -import net.fortuna.ical4j.model.ValidationException;
    1.43 -import net.fortuna.ical4j.util.ParameterValidator;
    1.44 -
    1.45 -/**
    1.46 - * $Id$
    1.47 - * 
    1.48 - * Created: [Apr 6, 2004]
    1.49 - *
    1.50 - * Defines a CATEGORIES iCalendar component property.
    1.51 - * <pre>
    1.52 - *     4.8.1.2 Categories
    1.53 - *     
    1.54 - *        Property Name: CATEGORIES
    1.55 - *     
    1.56 - *        Purpose: This property defines the categories for a calendar
    1.57 - *        component.
    1.58 - *     
    1.59 - *        Value Type: TEXT
    1.60 - *     
    1.61 - *        Property Parameters: Non-standard and language property parameters
    1.62 - *        can be specified on this property.
    1.63 - *     
    1.64 - *        Conformance: The property can be specified within "VEVENT", "VTODO"
    1.65 - *        or "VJOURNAL" calendar components.
    1.66 - *     
    1.67 - *        Description: This property is used to specify categories or subtypes
    1.68 - *        of the calendar component. The categories are useful in searching for
    1.69 - *        a calendar component of a particular type and category. Within the
    1.70 - *        "VEVENT", "VTODO" or "VJOURNAL" calendar components, more than one
    1.71 - *        category can be specified as a list of categories separated by the
    1.72 - *        COMMA character (US-ASCII decimal 44).
    1.73 - *     
    1.74 - *        Format Definition: The property is defined by the following notation:
    1.75 - *     
    1.76 - *          categories = "CATEGORIES" catparam ":" text *("," text)
    1.77 - *                       CRLF
    1.78 - *     
    1.79 - *          catparam   = *(
    1.80 - *     
    1.81 - *                     ; the following is optional,
    1.82 - *                     ; but MUST NOT occur more than once
    1.83 - *     
    1.84 - *                     (";" languageparam ) /
    1.85 - *     
    1.86 - *                     ; the following is optional,
    1.87 - *                     ; and MAY occur more than once
    1.88 - *     
    1.89 - *                     (";" xparam)
    1.90 - *     
    1.91 - *                     )
    1.92 - * </pre>
    1.93 - * @author benf
    1.94 - */
    1.95 -public class Categories extends Property {
    1.96 -
    1.97 -    private static final long serialVersionUID = -7769987073466681634L;
    1.98 -
    1.99 -    private TextList categories;
   1.100 -
   1.101 -    /**
   1.102 -     * Default constructor.
   1.103 -     */
   1.104 -    public Categories() {
   1.105 -        super(CATEGORIES, PropertyFactoryImpl.getInstance());
   1.106 -        categories = new TextList();
   1.107 -    }
   1.108 -
   1.109 -    /**
   1.110 -     * @param aValue a value string for this component
   1.111 -     */
   1.112 -    public Categories(final String aValue) {
   1.113 -        super(CATEGORIES, PropertyFactoryImpl.getInstance());
   1.114 -        setValue(aValue);
   1.115 -    }
   1.116 -
   1.117 -    /**
   1.118 -     * @param aList a list of parameters for this component
   1.119 -     * @param aValue a value string for this component
   1.120 -     */
   1.121 -    public Categories(final ParameterList aList, final String aValue) {
   1.122 -        super(CATEGORIES, aList, PropertyFactoryImpl.getInstance());
   1.123 -        setValue(aValue);
   1.124 -    }
   1.125 -
   1.126 -    /**
   1.127 -     * @param cList a list of categories
   1.128 -     */
   1.129 -    public Categories(final TextList cList) {
   1.130 -        super(CATEGORIES, PropertyFactoryImpl.getInstance());
   1.131 -        categories = cList;
   1.132 -    }
   1.133 -
   1.134 -    /**
   1.135 -     * @param aList a list of parameters for this component
   1.136 -     * @param cList a list of categories
   1.137 -     */
   1.138 -    public Categories(final ParameterList aList, final TextList cList) {
   1.139 -        super(CATEGORIES, aList, PropertyFactoryImpl.getInstance());
   1.140 -        categories = cList;
   1.141 -    }
   1.142 -
   1.143 -    /**
   1.144 -     * {@inheritDoc}
   1.145 -     */
   1.146 -    public final void setValue(final String aValue) {
   1.147 -        categories = new TextList(aValue);
   1.148 -    }
   1.149 -
   1.150 -    /**
   1.151 -     * {@inheritDoc}
   1.152 -     */
   1.153 -    public final void validate() throws ValidationException {
   1.154 -
   1.155 -        /*
   1.156 -         * ; the following is optional, ; but MUST NOT occur more than once (";" languageparam ) /
   1.157 -         */
   1.158 -        ParameterValidator.getInstance().assertOneOrLess(Parameter.LANGUAGE,
   1.159 -                getParameters());
   1.160 -
   1.161 -        /*
   1.162 -         * ; the following is optional, ; and MAY occur more than once (";" xparam)
   1.163 -         */
   1.164 -    }
   1.165 -
   1.166 -    /**
   1.167 -     * @return Returns the categories.
   1.168 -     */
   1.169 -    public final TextList getCategories() {
   1.170 -        return categories;
   1.171 -    }
   1.172 -
   1.173 -    /**
   1.174 -     * {@inheritDoc}
   1.175 -     */
   1.176 -    public final String getValue() {
   1.177 -        return getCategories().toString();
   1.178 -    }
   1.179 -}
   1.180 +/**
   1.181 + * Copyright (c) 2012, Ben Fortuna
   1.182 + * All rights reserved.
   1.183 + *
   1.184 + * Redistribution and use in source and binary forms, with or without
   1.185 + * modification, are permitted provided that the following conditions
   1.186 + * are met:
   1.187 + *
   1.188 + *  o Redistributions of source code must retain the above copyright
   1.189 + * notice, this list of conditions and the following disclaimer.
   1.190 + *
   1.191 + *  o Redistributions in binary form must reproduce the above copyright
   1.192 + * notice, this list of conditions and the following disclaimer in the
   1.193 + * documentation and/or other materials provided with the distribution.
   1.194 + *
   1.195 + *  o Neither the name of Ben Fortuna nor the names of any other contributors
   1.196 + * may be used to endorse or promote products derived from this software
   1.197 + * without specific prior written permission.
   1.198 + *
   1.199 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   1.200 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   1.201 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   1.202 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
   1.203 + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   1.204 + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   1.205 + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
   1.206 + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
   1.207 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   1.208 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   1.209 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   1.210 + */
   1.211 +package net.fortuna.ical4j.model.property;
   1.212 +
   1.213 +import net.fortuna.ical4j.model.TextList;
   1.214 +import net.fortuna.ical4j.model.Parameter;
   1.215 +import net.fortuna.ical4j.model.ParameterList;
   1.216 +import net.fortuna.ical4j.model.Property;
   1.217 +import net.fortuna.ical4j.model.PropertyFactoryImpl;
   1.218 +import net.fortuna.ical4j.model.ValidationException;
   1.219 +import net.fortuna.ical4j.util.ParameterValidator;
   1.220 +
   1.221 +/**
   1.222 + * $Id$
   1.223 + * 
   1.224 + * Created: [Apr 6, 2004]
   1.225 + *
   1.226 + * Defines a CATEGORIES iCalendar component property.
   1.227 + * <pre>
   1.228 + *     4.8.1.2 Categories
   1.229 + *     
   1.230 + *        Property Name: CATEGORIES
   1.231 + *     
   1.232 + *        Purpose: This property defines the categories for a calendar
   1.233 + *        component.
   1.234 + *     
   1.235 + *        Value Type: TEXT
   1.236 + *     
   1.237 + *        Property Parameters: Non-standard and language property parameters
   1.238 + *        can be specified on this property.
   1.239 + *     
   1.240 + *        Conformance: The property can be specified within "VEVENT", "VTODO"
   1.241 + *        or "VJOURNAL" calendar components.
   1.242 + *     
   1.243 + *        Description: This property is used to specify categories or subtypes
   1.244 + *        of the calendar component. The categories are useful in searching for
   1.245 + *        a calendar component of a particular type and category. Within the
   1.246 + *        "VEVENT", "VTODO" or "VJOURNAL" calendar components, more than one
   1.247 + *        category can be specified as a list of categories separated by the
   1.248 + *        COMMA character (US-ASCII decimal 44).
   1.249 + *     
   1.250 + *        Format Definition: The property is defined by the following notation:
   1.251 + *     
   1.252 + *          categories = "CATEGORIES" catparam ":" text *("," text)
   1.253 + *                       CRLF
   1.254 + *     
   1.255 + *          catparam   = *(
   1.256 + *     
   1.257 + *                     ; the following is optional,
   1.258 + *                     ; but MUST NOT occur more than once
   1.259 + *     
   1.260 + *                     (";" languageparam ) /
   1.261 + *     
   1.262 + *                     ; the following is optional,
   1.263 + *                     ; and MAY occur more than once
   1.264 + *     
   1.265 + *                     (";" xparam)
   1.266 + *     
   1.267 + *                     )
   1.268 + * </pre>
   1.269 + * @author benf
   1.270 + */
   1.271 +public class Categories extends Property {
   1.272 +
   1.273 +    private static final long serialVersionUID = -7769987073466681634L;
   1.274 +
   1.275 +    private TextList categories;
   1.276 +
   1.277 +    /**
   1.278 +     * Default constructor.
   1.279 +     */
   1.280 +    public Categories() {
   1.281 +        super(CATEGORIES, PropertyFactoryImpl.getInstance());
   1.282 +        categories = new TextList();
   1.283 +    }
   1.284 +
   1.285 +    /**
   1.286 +     * @param aValue a value string for this component
   1.287 +     */
   1.288 +    public Categories(final String aValue) {
   1.289 +        super(CATEGORIES, PropertyFactoryImpl.getInstance());
   1.290 +        setValue(aValue);
   1.291 +    }
   1.292 +
   1.293 +    /**
   1.294 +     * @param aList a list of parameters for this component
   1.295 +     * @param aValue a value string for this component
   1.296 +     */
   1.297 +    public Categories(final ParameterList aList, final String aValue) {
   1.298 +        super(CATEGORIES, aList, PropertyFactoryImpl.getInstance());
   1.299 +        setValue(aValue);
   1.300 +    }
   1.301 +
   1.302 +    /**
   1.303 +     * @param cList a list of categories
   1.304 +     */
   1.305 +    public Categories(final TextList cList) {
   1.306 +        super(CATEGORIES, PropertyFactoryImpl.getInstance());
   1.307 +        categories = cList;
   1.308 +    }
   1.309 +
   1.310 +    /**
   1.311 +     * @param aList a list of parameters for this component
   1.312 +     * @param cList a list of categories
   1.313 +     */
   1.314 +    public Categories(final ParameterList aList, final TextList cList) {
   1.315 +        super(CATEGORIES, aList, PropertyFactoryImpl.getInstance());
   1.316 +        categories = cList;
   1.317 +    }
   1.318 +
   1.319 +    /**
   1.320 +     * {@inheritDoc}
   1.321 +     */
   1.322 +    public final void setValue(final String aValue) {
   1.323 +        categories = new TextList(aValue);
   1.324 +    }
   1.325 +
   1.326 +    /**
   1.327 +     * {@inheritDoc}
   1.328 +     */
   1.329 +    public final void validate() throws ValidationException {
   1.330 +
   1.331 +        /*
   1.332 +         * ; the following is optional, ; but MUST NOT occur more than once (";" languageparam ) /
   1.333 +         */
   1.334 +        ParameterValidator.getInstance().assertOneOrLess(Parameter.LANGUAGE,
   1.335 +                getParameters());
   1.336 +
   1.337 +        /*
   1.338 +         * ; the following is optional, ; and MAY occur more than once (";" xparam)
   1.339 +         */
   1.340 +    }
   1.341 +
   1.342 +    /**
   1.343 +     * @return Returns the categories.
   1.344 +     */
   1.345 +    public final TextList getCategories() {
   1.346 +        return categories;
   1.347 +    }
   1.348 +
   1.349 +    /**
   1.350 +     * {@inheritDoc}
   1.351 +     */
   1.352 +    public final String getValue() {
   1.353 +        return getCategories().toString();
   1.354 +    }
   1.355 +}

mercurial