KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > launchConfigurations > EnvironmentVariable


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 Keith Seitz and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * Keith Seitz (keiths@redhat.com) - initial implementation
10  * IBM Corporation - integration and code cleanup
11  *******************************************************************************/

12 package org.eclipse.debug.internal.ui.launchConfigurations;
13
14 /**
15  * A key/value set whose data is passed into Runtime.exec(...)
16  */

17 public class EnvironmentVariable
18 {
19     // The name of the environment variable
20
private String JavaDoc name;
21     
22     // The value of the environment variable
23
private String JavaDoc value;
24     
25     public EnvironmentVariable(String JavaDoc name, String JavaDoc value)
26     {
27         this.name = name;
28         this.value = value;
29     }
30
31     /**
32      * Returns this variable's name, which serves as the key in the key/value
33      * pair this variable represents
34      *
35      * @return this variable's name
36      */

37     public String JavaDoc getName()
38     {
39         return name;
40     }
41     
42     /**
43      * Returns this variables value.
44      *
45      * @return this variable's value
46      */

47     public String JavaDoc getValue()
48     {
49         return value;
50     }
51         
52     /**
53      * Sets this variable's value
54      * @param value
55      */

56     public void setValue(String JavaDoc value)
57     {
58         this.value = value;
59     }
60     
61     /* (non-Javadoc)
62      * @see java.lang.Object#toString()
63      */

64     public String JavaDoc toString() {
65         return getName();
66     }
67     
68     
69     /* (non-Javadoc)
70      * @see java.lang.Object#equals(java.lang.Object)
71      */

72     public boolean equals(Object JavaDoc obj) {
73         boolean equal = false;
74         if (obj instanceof EnvironmentVariable) {
75             EnvironmentVariable var = (EnvironmentVariable)obj;
76             equal = var.getName().equals(name);
77         }
78         return equal;
79     }
80     /* (non-Javadoc)
81      * @see java.lang.Object#hashCode()
82      */

83     public int hashCode() {
84         return name.hashCode();
85     }
86 }
87
Popular Tags