2 * collectd/java - org/collectd/api/OConfigItem.java
3 * Copyright (C) 2009 Florian octo Forster
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.
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.
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
19 * Florian octo Forster <octo at verplant.org>
22 package org.collectd.api;
24 import java.util.List;
25 import java.util.ArrayList;
28 * Java representation of collectd/src/liboconfig/oconfig.h:oconfig_item_t structure.
30 * @author Florian Forster <octo at verplant.org>
32 public class OConfigItem
34 private String _key = null;
35 private List<OConfigValue> _values = new ArrayList<OConfigValue> ();
36 private List<OConfigItem> _children = new ArrayList<OConfigItem> ();
38 public OConfigItem (String key)
41 } /* OConfigItem (String key) */
43 public String getKey ()
46 } /* String getKey () */
48 public void addValue (OConfigValue cv)
51 } /* void addValue (OConfigValue cv) */
53 public void addValue (String s)
55 _values.add (new OConfigValue (s));
56 } /* void addValue (String s) */
58 public void addValue (Number n)
60 _values.add (new OConfigValue (n));
61 } /* void addValue (String s) */
63 public void addValue (boolean b)
65 _values.add (new OConfigValue (b));
66 } /* void addValue (String s) */
68 public List<OConfigValue> getValues ()
71 } /* List<OConfigValue> getValues () */
73 public void addChild (OConfigItem ci)
76 } /* void addChild (OConfigItem ci) */
78 public List<OConfigItem> getChildren ()
81 } /* List<OConfigItem> getChildren () */
83 public String toString ()
85 return (new String ("{ key: " + _key + "; "
86 + "values: " + _values.toString () + "; "
87 + "children: " + _children.toString () + "; }"));
88 } /* String toString () */
89 } /* class OConfigItem */
91 /* vim: set sw=2 sts=2 et fdm=marker : */