| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| EnumImpl |
|
| 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.core.model; | |
| 19 | ||
| 20 | import org.apache.shindig.social.opensocial.model.Enum; | |
| 21 | ||
| 22 | public final class EnumImpl<E extends Enum.EnumKey> implements Enum<E> { | |
| 23 | private String displayValue; | |
| 24 | 45 | private E value = null; |
| 25 | ||
| 26 | /** | |
| 27 | * Constructs a Enum object. | |
| 28 | * @param value EnumKey The key to use | |
| 29 | * @param displayValue String The display value | |
| 30 | */ | |
| 31 | 45 | public EnumImpl(E value, String displayValue) { |
| 32 | 45 | this.value = value; |
| 33 | 45 | this.displayValue = displayValue; |
| 34 | 45 | } |
| 35 | ||
| 36 | /** | |
| 37 | * Constructs a Enum object. | |
| 38 | * @param value The key to use. Will use the value from getDisplayValue() as | |
| 39 | * the display value. | |
| 40 | */ | |
| 41 | public EnumImpl(E value) { | |
| 42 | 18 | this(value, value.getDisplayValue()); |
| 43 | 18 | } |
| 44 | ||
| 45 | public String getDisplayValue() { | |
| 46 | 18 | return displayValue; |
| 47 | } | |
| 48 | ||
| 49 | public void setDisplayValue(String displayValue) { | |
| 50 | 0 | this.displayValue = displayValue; |
| 51 | 0 | } |
| 52 | ||
| 53 | public E getValue() { | |
| 54 | 18 | return value; |
| 55 | } | |
| 56 | ||
| 57 | public void setValue(E value) { | |
| 58 | 0 | this.value = value; |
| 59 | 0 | } |
| 60 | ||
| 61 | } |