KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > javaguard > KeyValue


1 /**
2  * JavaGuard -- an obfuscation package for Java classfiles.
3  *
4  * Copyright (c) 2002 Thorsten Heit (theit@gmx.de)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * The author may be contacted at theit@gmx.de.
21  *
22  *
23  * $Id: KeyValue.java,v 1.1.1.1 2002/04/03 13:49:44 glurk Exp $
24  */

25 package net.sf.javaguard;
26
27
28 /** Stores a key/value pair. Useful as a generic struct.
29  *
30  * @author <a HREF="mailto:theit@gmx.de">Thorsten Heit</a>
31  */

32 public class KeyValue {
33   /** Holds the key. */
34   private Object JavaDoc key;
35   /** Holds the value assigned to the key. */
36   private Object JavaDoc value;
37   
38   
39   
40   
41   /** Initializes a new key/value pair.
42    * @param key the new key
43    * @param value the object to assign to the key
44    */

45   public KeyValue(Object JavaDoc key, Object JavaDoc value) {
46     setKey(key);
47     setValue(value);
48   }
49   
50   
51   
52   
53   /** Sets the new key.
54    * @param aKey an object with the new key; may not be null
55    * @see #getKey
56    */

57   public void setKey(Object JavaDoc aKey) {
58     this.key = aKey;
59   }
60   
61   
62   /** Returns the current key.
63    * @return string holding the key
64    * @see #setKey
65    */

66   public Object JavaDoc getKey() {
67     return key;
68   }
69   
70   
71   
72   
73   /** Sets the object that is assigned to the key.
74    * @param theValue the object to assign to the key; may be null
75    * @see #getValue
76    */

77   public void setValue(Object JavaDoc theValue) {
78     this.value = theValue;
79   }
80   
81   
82   /** Returns the current object assigned to the key.
83    * @return object assigned to the key; may be null
84    * @see #setValue
85    */

86   public Object JavaDoc getValue() {
87     return value;
88   }
89 }
90
Popular Tags