1 | // Copyright 2004-2007 Jean-Francois Poilpret |
2 | // |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | // you may not use this file except in compliance with the License. |
5 | // You may obtain a copy of the License at |
6 | // |
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | // |
9 | // Unless required by applicable law or agreed to in writing, software |
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | // See the License for the specific language governing permissions and |
13 | // limitations under the License. |
14 | |
15 | package net.sourceforge.hiveutils.collections; |
16 | |
17 | /** |
18 | * Utility class to hold a "name-value" pair. |
19 | * Convenient for property handling. |
20 | * |
21 | * @author Jean-Francois Poilpret |
22 | */ |
23 | public class NameValuePair |
24 | { |
25 | /** |
26 | * Constructs a default name-value pair. Name and Value should be filled in |
27 | * later by setter methods. |
28 | */ |
29 | public NameValuePair() |
30 | { |
31 | } |
32 | |
33 | /** |
34 | * Constructs a name-value pair with the given name and value. |
35 | * @param name name of the pair |
36 | * @param value value of the pair |
37 | */ |
38 | public NameValuePair(String name, String value) |
39 | { |
40 | _name = name; |
41 | _value = value; |
42 | } |
43 | |
44 | /** |
45 | * Sets a name to this name-value pair. |
46 | * @param name new name of the pair |
47 | */ |
48 | public void setName(String name) |
49 | { |
50 | _name = name; |
51 | } |
52 | |
53 | /** |
54 | * Gets the name of this name-value pair. |
55 | * @return name of the pair |
56 | */ |
57 | public String getName() |
58 | { |
59 | return _name; |
60 | } |
61 | |
62 | /** |
63 | * Sets a value to this name-value pair. |
64 | * @param value new value of the pair |
65 | */ |
66 | public void setValue(String value) |
67 | { |
68 | _value = value; |
69 | } |
70 | |
71 | /** |
72 | * Gets the value of this name-value pair. |
73 | * @return value of the pair |
74 | */ |
75 | public String getValue() |
76 | { |
77 | return _value; |
78 | } |
79 | |
80 | private String _name; |
81 | private String _value; |
82 | } |