src/net/fortuna/ical4j/util/Constants.java

branch
ICAL4J_EMBED_1
changeset 15
cc93757aeca3
parent 14
5ae3e5665a0b
child 18
6dcaece8ec41
     1.1 --- a/src/net/fortuna/ical4j/util/Constants.java	Thu Feb 12 18:02:00 2015 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,172 +0,0 @@
     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.util;
    1.36 -
    1.37 -import net.fortuna.ical4j.model.Property;
    1.38 -import net.fortuna.ical4j.model.property.Action;
    1.39 -import net.fortuna.ical4j.model.property.CalScale;
    1.40 -import net.fortuna.ical4j.model.property.Clazz;
    1.41 -import net.fortuna.ical4j.model.property.Method;
    1.42 -import net.fortuna.ical4j.model.property.Priority;
    1.43 -import net.fortuna.ical4j.model.property.Status;
    1.44 -import net.fortuna.ical4j.model.property.Transp;
    1.45 -import net.fortuna.ical4j.model.property.Version;
    1.46 -
    1.47 -/**
    1.48 - * $Id$
    1.49 - *
    1.50 - * Created on 5/07/2005
    1.51 - *
    1.52 - * Provides some convenience methods for working with constant
    1.53 - * parameters and properties.
    1.54 - * @author Ben Fortuna
    1.55 - */
    1.56 -public final class Constants {
    1.57 -
    1.58 -    /**
    1.59 -     * Constructor made private to enforce static nature.
    1.60 -     */
    1.61 -    private Constants() {
    1.62 -    }
    1.63 -    
    1.64 -    /**
    1.65 -     * Returns a constant equivalent to the specified property
    1.66 -     * if one is applicable. Otherwise will return the specified
    1.67 -     * property.
    1.68 -     * @param property a property instance
    1.69 -     * @return an equivalent constant property, or the specified property if no equivalent
    1.70 -     * constant exists
    1.71 -     */
    1.72 -    public static Property forProperty(final Property property) {
    1.73 -        Property retVal = property;
    1.74 -        if (Action.AUDIO.equals(property)) {
    1.75 -            retVal = Action.AUDIO;
    1.76 -        }
    1.77 -        else if (Action.DISPLAY.equals(property)) {
    1.78 -            retVal = Action.DISPLAY;
    1.79 -        }
    1.80 -        else if (Action.EMAIL.equals(property)) {
    1.81 -            retVal = Action.EMAIL;
    1.82 -        }
    1.83 -        else if (Action.PROCEDURE.equals(property)) {
    1.84 -            retVal = Action.PROCEDURE;
    1.85 -        }
    1.86 -        else if (CalScale.GREGORIAN.equals(property)) {
    1.87 -            retVal = CalScale.GREGORIAN;
    1.88 -        }
    1.89 -        else if (Clazz.CONFIDENTIAL.equals(property)) {
    1.90 -            retVal = Clazz.CONFIDENTIAL;
    1.91 -        }
    1.92 -        else if (Clazz.PRIVATE.equals(property)) {
    1.93 -            retVal = Clazz.PRIVATE;
    1.94 -        }
    1.95 -        else if (Clazz.PUBLIC.equals(property)) {
    1.96 -            retVal = Clazz.PUBLIC;
    1.97 -        }
    1.98 -        else if (Method.ADD.equals(property)) {
    1.99 -            retVal = Method.ADD;
   1.100 -        }
   1.101 -        else if (Method.CANCEL.equals(property)) {
   1.102 -            retVal = Method.CANCEL;
   1.103 -        }
   1.104 -        else if (Method.COUNTER.equals(property)) {
   1.105 -            retVal = Method.COUNTER;
   1.106 -        }
   1.107 -        else if (Method.DECLINE_COUNTER.equals(property)) {
   1.108 -            retVal = Method.DECLINE_COUNTER;
   1.109 -        }
   1.110 -        else if (Method.PUBLISH.equals(property)) {
   1.111 -            retVal = Method.PUBLISH;
   1.112 -        }
   1.113 -        else if (Method.REFRESH.equals(property)) {
   1.114 -            retVal = Method.REFRESH;
   1.115 -        }
   1.116 -        else if (Method.REPLY.equals(property)) {
   1.117 -            retVal = Method.REPLY;
   1.118 -        }
   1.119 -        else if (Method.REQUEST.equals(property)) {
   1.120 -            retVal = Method.REQUEST;
   1.121 -        }
   1.122 -        else if (Priority.HIGH.equals(property)) {
   1.123 -            retVal = Priority.HIGH;
   1.124 -        }
   1.125 -        else if (Priority.LOW.equals(property)) {
   1.126 -            retVal = Priority.LOW;
   1.127 -        }
   1.128 -        else if (Priority.MEDIUM.equals(property)) {
   1.129 -            retVal = Priority.MEDIUM;
   1.130 -        }
   1.131 -        else if (Priority.UNDEFINED.equals(property)) {
   1.132 -            retVal = Priority.UNDEFINED;
   1.133 -        }
   1.134 -        else if (Status.VEVENT_CANCELLED.equals(property)) {
   1.135 -            retVal = Status.VEVENT_CANCELLED;
   1.136 -        }
   1.137 -        else if (Status.VEVENT_CONFIRMED.equals(property)) {
   1.138 -            retVal = Status.VEVENT_CONFIRMED;
   1.139 -        }
   1.140 -        else if (Status.VEVENT_TENTATIVE.equals(property)) {
   1.141 -            retVal = Status.VEVENT_TENTATIVE;
   1.142 -        }
   1.143 -        else if (Status.VJOURNAL_CANCELLED.equals(property)) {
   1.144 -            retVal = Status.VJOURNAL_CANCELLED;
   1.145 -        }
   1.146 -        else if (Status.VJOURNAL_DRAFT.equals(property)) {
   1.147 -            retVal = Status.VJOURNAL_DRAFT;
   1.148 -        }
   1.149 -        else if (Status.VJOURNAL_FINAL.equals(property)) {
   1.150 -            retVal = Status.VJOURNAL_FINAL;
   1.151 -        }
   1.152 -        else if (Status.VTODO_CANCELLED.equals(property)) {
   1.153 -            retVal = Status.VTODO_CANCELLED;
   1.154 -        }
   1.155 -        else if (Status.VTODO_COMPLETED.equals(property)) {
   1.156 -            retVal = Status.VTODO_COMPLETED;
   1.157 -        }
   1.158 -        else if (Status.VTODO_IN_PROCESS.equals(property)) {
   1.159 -            retVal = Status.VTODO_IN_PROCESS;
   1.160 -        }
   1.161 -        else if (Status.VTODO_NEEDS_ACTION.equals(property)) {
   1.162 -            retVal = Status.VTODO_NEEDS_ACTION;
   1.163 -        }
   1.164 -        else if (Transp.OPAQUE.equals(property)) {
   1.165 -            retVal = Transp.OPAQUE;
   1.166 -        }
   1.167 -        else if (Transp.TRANSPARENT.equals(property)) {
   1.168 -            retVal = Transp.TRANSPARENT;
   1.169 -        }
   1.170 -        else if (Version.VERSION_2_0.equals(property)) {
   1.171 -            retVal = Version.VERSION_2_0;
   1.172 -        }
   1.173 -        return retVal;
   1.174 -    }
   1.175 -}

mercurial