| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Enum |
|
| 0.0;0 | ||||
| Enum$Drinker |
|
| 0.0;0 | ||||
| Enum$EnumKey |
|
| 0.0;0 | ||||
| Enum$Field |
|
| 0.0;0 | ||||
| Enum$LookingFor |
|
| 0.0;0 | ||||
| Enum$NetworkPresence |
|
| 0.0;0 | ||||
| Enum$Smoker |
|
| 0.0;0 |
| 1 | /* | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one | |
| 3 | * or more contributor license agreements. See the NOTICE file | |
| 4 | * distributed with this work for additional information | |
| 5 | * regarding copyright ownership. The ASF licenses this file | |
| 6 | * to you under the Apache License, Version 2.0 (the | |
| 7 | * "License"); you may not use this file except in compliance | |
| 8 | * with the License. You may obtain a copy of the License at | |
| 9 | * | |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 11 | * | |
| 12 | * Unless required by applicable law or agreed to in writing, | |
| 13 | * software distributed under the License is distributed on an | |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| 15 | * KIND, either express or implied. See the License for the | |
| 16 | * specific language governing permissions and limitations under the License. | |
| 17 | */ | |
| 18 | package org.apache.shindig.social.opensocial.model; | |
| 19 | ||
| 20 | /** | |
| 21 | * see http://code.google.com/apis/opensocial/docs/0.7/reference/opensocial.Enum.html | |
| 22 | * | |
| 23 | * Base class for all Enum objects. This class allows containers to use constants for fields that | |
| 24 | * have a common set of values. | |
| 25 | */ | |
| 26 | @Exportablebean | |
| 27 | public interface Enum<E extends Enum.EnumKey> { | |
| 28 | ||
| 29 | /** | |
| 30 | * Set of fields associated with an Enum object. | |
| 31 | */ | |
| 32 | 1 | public static enum Field { |
| 33 | /** | |
| 34 | * The value of the field. | |
| 35 | */ | |
| 36 | 1 | VALUE("value"), |
| 37 | /** | |
| 38 | * The display value of the field. | |
| 39 | */ | |
| 40 | 1 | DISPLAY_VALUE("displayValue"); |
| 41 | ||
| 42 | /** | |
| 43 | * The json representation of the feild enum. | |
| 44 | */ | |
| 45 | private final String jsonString; | |
| 46 | ||
| 47 | /** | |
| 48 | * Create a field enum. | |
| 49 | * @param jsonString the json value of the enum. | |
| 50 | */ | |
| 51 | 2 | private Field(String jsonString) { |
| 52 | 2 | this.jsonString = jsonString; |
| 53 | 2 | } |
| 54 | ||
| 55 | /** | |
| 56 | * {@inheritDoc} | |
| 57 | * @see java.lang.Enum#toString() | |
| 58 | */ | |
| 59 | @Override | |
| 60 | public String toString() { | |
| 61 | 45 | return this.jsonString; |
| 62 | } | |
| 63 | } | |
| 64 | ||
| 65 | /** | |
| 66 | * base interface for keyed Enumerators. | |
| 67 | */ | |
| 68 | public interface EnumKey { | |
| 69 | String getDisplayValue(); | |
| 70 | } | |
| 71 | ||
| 72 | /** | |
| 73 | * public java.lang.Enum for opensocial.Enum.Drinker. | |
| 74 | */ | |
| 75 | 1 | public enum Drinker implements EnumKey { |
| 76 | /** Heavy drinker. */ | |
| 77 | 1 | HEAVILY("HEAVILY", "Heavily"), |
| 78 | /** non drinker. */ | |
| 79 | 1 | NO("NO", "No"), |
| 80 | /** occasional drinker. */ | |
| 81 | 1 | OCCASIONALLY("OCCASIONALLY", "Occasionally"), |
| 82 | /** has quit drinking. */ | |
| 83 | 1 | QUIT("QUIT", "Quit"), |
| 84 | /** in the process of quitting. */ | |
| 85 | 1 | QUITTING("QUITTING", "Quitting"), |
| 86 | /** regular drinker. */ | |
| 87 | 1 | REGULARLY("REGULARLY", "Regularly"), |
| 88 | /** drinks socially. */ | |
| 89 | 1 | SOCIALLY("SOCIALLY", "Socially"), |
| 90 | /** yes, a drinker of alchhol. */ | |
| 91 | 1 | YES("YES", "Yes"); |
| 92 | ||
| 93 | /** | |
| 94 | * the Json representation. | |
| 95 | */ | |
| 96 | private final String jsonString; | |
| 97 | ||
| 98 | /** | |
| 99 | * the value used for display purposes. | |
| 100 | */ | |
| 101 | private final String displayValue; | |
| 102 | ||
| 103 | /** | |
| 104 | * private internal constructor for the enum. | |
| 105 | * @param jsonString the json representation. | |
| 106 | * @param displayValue the display value. | |
| 107 | */ | |
| 108 | 8 | private Drinker(String jsonString, String displayValue) { |
| 109 | 8 | this.jsonString = jsonString; |
| 110 | 8 | this.displayValue = displayValue; |
| 111 | 8 | } |
| 112 | ||
| 113 | /** | |
| 114 | * {@inheritDoc} | |
| 115 | * @see java.lang.Enum#toString() | |
| 116 | */ | |
| 117 | @Override | |
| 118 | public String toString() { | |
| 119 | 1 | return this.jsonString; |
| 120 | } | |
| 121 | ||
| 122 | /** | |
| 123 | * {@inheritDoc} | |
| 124 | * @see org.apache.shindig.social.opensocial.model.Enum.EnumKey#getDisplayValue() | |
| 125 | */ | |
| 126 | public String getDisplayValue() { | |
| 127 | 6 | return displayValue; |
| 128 | } | |
| 129 | } | |
| 130 | ||
| 131 | /** | |
| 132 | * public java.lang.Enum for opensocial.Enum.Smoker. | |
| 133 | */ | |
| 134 | 1 | public enum Smoker implements EnumKey { |
| 135 | /** A heavy smoker. */ | |
| 136 | 1 | HEAVILY("HEAVILY", "Heavily"), |
| 137 | /** Non smoker. */ | |
| 138 | 1 | NO("NO", "No"), |
| 139 | /** Smokes occasionally. */ | |
| 140 | 1 | OCCASIONALLY("OCCASIONALLY", "Ocasionally"), |
| 141 | /** Has quit smoking. */ | |
| 142 | 1 | QUIT("QUIT", "Quit"), |
| 143 | /** in the process of quitting smoking. */ | |
| 144 | 1 | QUITTING("QUITTING", "Quitting"), |
| 145 | /** regular smoker, but not a heavy smoker. */ | |
| 146 | 1 | REGULARLY("REGULARLY", "Regularly"), |
| 147 | /** smokes socially. */ | |
| 148 | 1 | SOCIALLY("SOCIALLY", "Socially"), |
| 149 | /** yes, a smoker. */ | |
| 150 | 1 | YES("YES", "Yes"); |
| 151 | ||
| 152 | /** | |
| 153 | * The Json representation of the value. | |
| 154 | */ | |
| 155 | private final String jsonString; | |
| 156 | ||
| 157 | /** | |
| 158 | * The value used for display purposes. | |
| 159 | */ | |
| 160 | private final String displayValue; | |
| 161 | ||
| 162 | /** | |
| 163 | * Create a Smoker enumeration. | |
| 164 | * @param jsonString the json representation of the value. | |
| 165 | * @param displayValue the value used for display purposes. | |
| 166 | */ | |
| 167 | 8 | private Smoker(String jsonString, String displayValue) { |
| 168 | 8 | this.jsonString = jsonString; |
| 169 | 8 | this.displayValue = displayValue; |
| 170 | 8 | } |
| 171 | ||
| 172 | /** | |
| 173 | * {@inheritDoc} | |
| 174 | * @see java.lang.Enum#toString() | |
| 175 | */ | |
| 176 | @Override | |
| 177 | public String toString() { | |
| 178 | 3 | return this.jsonString; |
| 179 | } | |
| 180 | ||
| 181 | /** | |
| 182 | * {@inheritDoc} | |
| 183 | * @see org.apache.shindig.social.opensocial.model.Enum.EnumKey#getDisplayValue() | |
| 184 | */ | |
| 185 | public String getDisplayValue() { | |
| 186 | 6 | return displayValue; |
| 187 | } | |
| 188 | } | |
| 189 | ||
| 190 | /** | |
| 191 | * public java.lang.Enum for opensocial.Enum.NetworkPresence. | |
| 192 | */ | |
| 193 | 1 | public enum NetworkPresence implements EnumKey { |
| 194 | /** Currently Online. */ | |
| 195 | 1 | ONLINE("ONLINE", "Online"), |
| 196 | /** Currently Offline. */ | |
| 197 | 1 | OFFLINE("OFFLINE", "Offline"), |
| 198 | /** Currently online but away. */ | |
| 199 | 1 | AWAY("AWAY", "Away"), |
| 200 | /** In a chat or available to chat. */ | |
| 201 | 1 | CHAT("CHAT", "Chat"), |
| 202 | /** Online, but don't disturb. */ | |
| 203 | 1 | DND("DND", "Do Not Disturb"), |
| 204 | /** Gone away for a longer period of time. */ | |
| 205 | 1 | XA("XA", "Extended Away"); |
| 206 | ||
| 207 | /** | |
| 208 | * The Json representation of the value. | |
| 209 | */ | |
| 210 | private final String jsonString; | |
| 211 | ||
| 212 | /** | |
| 213 | * The value used for display purposes. | |
| 214 | */ | |
| 215 | private final String displayValue; | |
| 216 | ||
| 217 | /** | |
| 218 | * Create a network presence enum. | |
| 219 | * @param jsonString the json value. | |
| 220 | * @param displayValue the display value. | |
| 221 | */ | |
| 222 | 6 | private NetworkPresence(String jsonString, String displayValue) { |
| 223 | 6 | this.jsonString = jsonString; |
| 224 | 6 | this.displayValue = displayValue; |
| 225 | 6 | } |
| 226 | ||
| 227 | /** | |
| 228 | * {@inheritDoc} | |
| 229 | * @see java.lang.Enum#toString() | |
| 230 | */ | |
| 231 | @Override | |
| 232 | public String toString() { | |
| 233 | 3 | return this.jsonString; |
| 234 | } | |
| 235 | ||
| 236 | /** | |
| 237 | * {@inheritDoc} | |
| 238 | * @see org.apache.shindig.social.opensocial.model.Enum.EnumKey#getDisplayValue() | |
| 239 | */ | |
| 240 | public String getDisplayValue() { | |
| 241 | 6 | return displayValue; |
| 242 | } | |
| 243 | } | |
| 244 | ||
| 245 | /** | |
| 246 | * public java.lang.Enum for opensocial.Enum.LookingFor. | |
| 247 | */ | |
| 248 | 1 | public enum LookingFor implements EnumKey { |
| 249 | /** Interested in dating. */ | |
| 250 | 1 | DATING("DATING", "Dating"), |
| 251 | /** Looking for friends. */ | |
| 252 | 1 | FRIENDS("FRIENDS", "Friends"), |
| 253 | /** Looking for a relationship. */ | |
| 254 | 1 | RELATIONSHIP("RELATIONSHIP", "Relationship"), |
| 255 | /** Just want to network. */ | |
| 256 | 1 | NETWORKING("NETWORKING", "Networking"), |
| 257 | /** */ | |
| 258 | 1 | ACTIVITY_PARTNERS("ACTIVITY_PARTNERS", "Activity partners"), |
| 259 | /** */ | |
| 260 | 1 | RANDOM("RANDOM", "Random"); |
| 261 | ||
| 262 | /** | |
| 263 | * The Json representation of the value. | |
| 264 | */ | |
| 265 | private final String jsonString; | |
| 266 | ||
| 267 | /** | |
| 268 | * The value used for display purposes. | |
| 269 | */ | |
| 270 | private final String displayValue; | |
| 271 | ||
| 272 | /** | |
| 273 | * Construct a looking for enum. | |
| 274 | * @param jsonString the json representation of the enum. | |
| 275 | * @param displayValue the value used for display purposes. | |
| 276 | */ | |
| 277 | 6 | private LookingFor(String jsonString, String displayValue) { |
| 278 | 6 | this.jsonString = jsonString; |
| 279 | 6 | this.displayValue = displayValue; |
| 280 | 6 | } |
| 281 | ||
| 282 | /** | |
| 283 | * {@inheritDoc} | |
| 284 | * @see java.lang.Enum#toString() | |
| 285 | */ | |
| 286 | @Override | |
| 287 | public String toString() { | |
| 288 | 6 | return this.jsonString; |
| 289 | } | |
| 290 | ||
| 291 | /** | |
| 292 | * {@inheritDoc} | |
| 293 | * @see org.apache.shindig.social.opensocial.model.Enum.EnumKey#getDisplayValue() | |
| 294 | */ | |
| 295 | public String getDisplayValue() { | |
| 296 | 0 | return displayValue; |
| 297 | } | |
| 298 | } | |
| 299 | ||
| 300 | /** | |
| 301 | * Gets the value of this Enum. This is the string displayed to the user. If the container | |
| 302 | * supports localization, the string should be localized. | |
| 303 | * | |
| 304 | * @return the Enum's user visible value | |
| 305 | */ | |
| 306 | String getDisplayValue(); | |
| 307 | ||
| 308 | /** | |
| 309 | * Sets the value of this Enum. This is the string displayed to the user. If the container | |
| 310 | * supports localization, the string should be localized. | |
| 311 | * | |
| 312 | * @param displayValue The value to set. | |
| 313 | */ | |
| 314 | void setDisplayValue(String displayValue); | |
| 315 | ||
| 316 | /** | |
| 317 | * Gets the key for this Enum. Use this for logic within your gadget. | |
| 318 | * | |
| 319 | * @return java.lang.Enum key object for this Enum. | |
| 320 | */ | |
| 321 | E getValue(); | |
| 322 | ||
| 323 | /** | |
| 324 | * Sets the key for this Enum. Use this for logic within your gadget. | |
| 325 | * | |
| 326 | * @param value The value to set. | |
| 327 | */ | |
| 328 | void setValue(E value); | |
| 329 | } |