1 /**
2 * Copyright 2005-2006 the original author or authors.
3 *
4 * Licensed under the Gnu General Pubic License, Version 2.0 (the
5 * "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/gpl-license.php
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the Gnu General Public License for more details.
14 */
15 package org.figure8.join.core.setup;
16
17 /**
18 * A Java Bean representing a configuration property (or a configuration element).
19 * Such properties are intended to be loaded from application configuration file
20 * during bootstrap phase. A property has a <code>key</code> and a <code>value</code>.
21 * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
22 * @version $Revision: 1.2 $
23 */
24 public class ConfigProperty{
25
26
27
28 /** Key of this configuration property. */
29 private String key = null;
30 /** Value of this configuration property. */
31 private String value = null;
32
33
34
35
36 /** Creates a new instance of ConfigProperty */
37 public ConfigProperty(){
38 }
39
40 /**
41 * Creates a new instance of ConfigProperty
42 * @param key Key of this property
43 * @param value Value associated to key
44 */
45 public ConfigProperty(String key, String value){
46 setKey(key);
47 setValue(value);
48 }
49
50
51
52
53 /** @param key Key identifier of the property */
54 public void setKey(String key){
55 this.key = key;
56 }
57 /** @return The key identifier of the property */
58 public String getKey(){
59 return key;
60 }
61
62 /** @param value The string value of this property */
63 public void setValue(String value){
64 this.value = value;
65 }
66 /** @return The string value of this property */
67 public String getValue(){
68 return value;
69 }
70
71
72
73
74 /**
75 * Return an Xml string representation of this ConfigProperty
76 * @return Xml string representing this property
77 */
78 public String toString(){
79 StringBuffer buffer = new StringBuffer("<property key=\"");
80 buffer.append(key + "\" value=\"");
81 buffer.append(value + "\"/>");
82 return buffer.toString();
83 }
84 }