2 * collectd - bindings/java/org/collectd/api/OConfigItem.java
3 * Copyright (C) 2009 Florian octo Forster
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 * Florian octo Forster <octo at collectd.org>
27 package org.collectd.api;
29 import java.util.List;
30 import java.util.ArrayList;
33 * Java representation of collectd/src/liboconfig/oconfig.h:oconfig_item_t structure.
35 * @author Florian Forster <octo at collectd.org>
37 public class OConfigItem
39 private String _key = null;
40 private List<OConfigValue> _values = new ArrayList<OConfigValue> ();
41 private List<OConfigItem> _children = new ArrayList<OConfigItem> ();
43 public OConfigItem (String key)
46 } /* OConfigItem (String key) */
48 public String getKey ()
51 } /* String getKey () */
53 public void addValue (OConfigValue cv)
56 } /* void addValue (OConfigValue cv) */
58 public void addValue (String s)
60 _values.add (new OConfigValue (s));
61 } /* void addValue (String s) */
63 public void addValue (Number n)
65 _values.add (new OConfigValue (n));
66 } /* void addValue (String s) */
68 public void addValue (boolean b)
70 _values.add (new OConfigValue (b));
71 } /* void addValue (String s) */
73 public List<OConfigValue> getValues ()
76 } /* List<OConfigValue> getValues () */
78 public void addChild (OConfigItem ci)
81 } /* void addChild (OConfigItem ci) */
83 public List<OConfigItem> getChildren ()
86 } /* List<OConfigItem> getChildren () */
88 public String toString ()
90 return (new String ("{ key: " + _key + "; "
91 + "values: " + _values.toString () + "; "
92 + "children: " + _children.toString () + "; }"));
93 } /* String toString () */
94 } /* class OConfigItem */
96 /* vim: set sw=2 sts=2 et fdm=marker : */