781af0904b65736219815505179059fcc0b6e47f
1 /*
2 * collectd/java - org/collectd/api/OConfigItem.java
3 * Copyright (C) 2009 Florian octo Forster
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; only version 2 of the License is applicable.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 * Authors:
19 * Florian octo Forster <octo at verplant.org>
20 */
22 package org.collectd.api;
24 import java.util.List;
25 import java.util.ArrayList;
27 public class OConfigItem
28 {
29 private String _key = null;
30 private List<OConfigValue> _values = new ArrayList<OConfigValue> ();
31 private List<OConfigItem> _children = new ArrayList<OConfigItem> ();
33 public OConfigItem (String key)
34 {
35 _key = key;
36 } /* OConfigItem (String key) */
38 public String getKey ()
39 {
40 return (_key);
41 } /* String getKey () */
43 public void addValue (OConfigValue cv)
44 {
45 _values.add (cv);
46 } /* void addValue (OConfigValue cv) */
48 public void addValue (String s)
49 {
50 _values.add (new OConfigValue (s));
51 } /* void addValue (String s) */
53 public void addValue (Number n)
54 {
55 _values.add (new OConfigValue (n));
56 } /* void addValue (String s) */
58 public void addValue (boolean b)
59 {
60 _values.add (new OConfigValue (b));
61 } /* void addValue (String s) */
63 public List<OConfigValue> getValues ()
64 {
65 return (_values);
66 } /* List<OConfigValue> getValues () */
68 public void addChild (OConfigItem ci)
69 {
70 _children.add (ci);
71 } /* void addChild (OConfigItem ci) */
73 public List<OConfigItem> getChildren ()
74 {
75 return (_children);
76 } /* List<OConfigItem> getChildren () */
78 public String toString ()
79 {
80 return (new String ("{ key: " + _key + "; "
81 + "values: " + _values.toString () + "; "
82 + "children: " + _children.toString () + "; }"));
83 } /* String toString () */
84 } /* class OConfigItem */
86 /* vim: set sw=2 sts=2 et fdm=marker : */