2 * jSite2 - ConfigData.java -
3 * Copyright © 2008 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
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. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package net.pterodactylus.util.fcp;
23 * A “ConfigData” message contains various aspects of the node’s configuration.
26 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
29 public class ConfigData extends BaseMessage {
32 * Creates a new “ConfigData” message that wraps the received message.
34 * @param receivedMessage
35 * The received message
37 ConfigData(FcpMessage receivedMessage) {
38 super(receivedMessage);
42 * Returns the current value of the given option.
45 * The name of the option
46 * @return The current value of the option
48 public String getCurrent(String option) {
49 return getField("current." + option);
53 * Returns the short description of the given option.
56 * The name of the option
57 * @return The short description of the option
59 public String getShortDescription(String option) {
60 return getField("shortDescription." + option);
64 * Returns the long description of the given option.
67 * The name of the option
68 * @return The long description of the option
70 public String getLongDescription(String option) {
71 return getField("longDescription." + option);
75 * Returns the data type of the given option.
78 * The name of the option
79 * @return The data type of the option
81 public String getDataType(String option) {
82 return getField("dataType." + option);
86 * Returns the default value of the given option.
89 * The name of the option
90 * @return The default value of the option
92 public String getDefault(String option) {
93 return getField("default." + option);
97 * Returns the sort order of the given option.
100 * The name of the option
101 * @return The sort order of the option, or <code>-1</code> if the sort
102 * order could not be parsed
104 public int getSortOrder(String option) {
105 return FcpUtils.safeParseInt(getField("sortOrder." + option));
109 * Returns the expert flag of the given option.
112 * The name of the option
113 * @return The expert flag of the option
115 public boolean getExpertFlag(String option) {
116 return Boolean.valueOf(getField("expertFlag." + option));
120 * Returns the force-write flag of the given option
123 * The name of the option
124 * @return The force-write flag of the given option
126 public boolean getForceWriteFlag(String option) {
127 return Boolean.valueOf(getField("forceWriteFlag." + option));