Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MapEntry |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 1999-2001,2004 The Apache Software Foundation. | |
3 | * | |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | package org.apache.commons.workflow.util; | |
18 | ||
19 | ||
20 | import java.util.Map; | |
21 | ||
22 | ||
23 | /** | |
24 | * General purpose implementation of the <strong>Map.Entry</strong> | |
25 | * interface for use in returning results from <code>entrySet()</code> | |
26 | * methods on <code>Map</code> implementations. | |
27 | * | |
28 | * @version $Revision: 155475 $ $Date: 2005-02-26 13:31:11 +0000 (Sat, 26 Feb 2005) $ | |
29 | * @author Craig R. McClanahan | |
30 | */ | |
31 | ||
32 | public class MapEntry implements Map.Entry { | |
33 | ||
34 | ||
35 | // ----------------------------------------------------------- Constructors | |
36 | ||
37 | ||
38 | /** | |
39 | * Construct a new MapEntry based on the specified parameters. | |
40 | * | |
41 | * @param key Key for this entry | |
42 | * @param value Value for this entry | |
43 | */ | |
44 | public MapEntry(Object key, Object value) { | |
45 | ||
46 | 0 | super(); |
47 | 0 | setKey(key); |
48 | 0 | setValue(value); |
49 | ||
50 | 0 | } |
51 | ||
52 | ||
53 | ||
54 | // ------------------------------------------------------------- Properties | |
55 | ||
56 | ||
57 | /** | |
58 | * The key for this entry. | |
59 | */ | |
60 | 0 | protected Object key = null; |
61 | ||
62 | public Object getKey() { | |
63 | 0 | return (this.key); |
64 | } | |
65 | ||
66 | public void setKey(Object key) { | |
67 | 0 | this.key = key; |
68 | 0 | } |
69 | ||
70 | ||
71 | /** | |
72 | * The value for for this entry. | |
73 | */ | |
74 | 0 | protected Object value = null; |
75 | ||
76 | public Object getValue() { | |
77 | 0 | return (this.value); |
78 | } | |
79 | ||
80 | public Object setValue(Object value) { | |
81 | 0 | Object old = this.value; |
82 | 0 | this.value = value; |
83 | 0 | return (old); |
84 | } | |
85 | ||
86 | ||
87 | } |