2 * jFCPlib - ConfigData.java - Copyright © 2008–2016 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.fcp;
21 * A “ConfigData” message contains various aspects of the node’s configuration.
24 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
26 public class ConfigData extends BaseMessage {
29 * Creates a new “ConfigData” message that wraps the received message.
31 * @param receivedMessage
32 * The received message
34 public ConfigData(FcpMessage receivedMessage) {
35 super(receivedMessage);
39 * Returns the current value of the given option.
42 * The name of the option
43 * @return The current value of the option
45 public String getCurrent(String option) {
46 return getField("current." + option);
50 * Returns the short description of the given option.
53 * The name of the option
54 * @return The short description of the option
56 public String getShortDescription(String option) {
57 return getField("shortDescription." + option);
61 * Returns the long description of the given option.
64 * The name of the option
65 * @return The long description of the option
67 public String getLongDescription(String option) {
68 return getField("longDescription." + option);
72 * Returns the data type of the given option.
75 * The name of the option
76 * @return The data type of the option
78 public String getDataType(String option) {
79 return getField("dataType." + option);
83 * Returns the default value of the given option.
86 * The name of the option
87 * @return The default value of the option
89 public String getDefault(String option) {
90 return getField("default." + option);
94 * Returns the sort order of the given option.
97 * The name of the option
98 * @return The sort order of the option, or <code>-1</code> if the sort
99 * order could not be parsed
101 public int getSortOrder(String option) {
102 return FcpUtils.safeParseInt(getField("sortOrder." + option));
106 * Returns the expert flag of the given option.
109 * The name of the option
110 * @return The expert flag of the option
112 public boolean getExpertFlag(String option) {
113 return Boolean.valueOf(getField("expertFlag." + option));
117 * Returns the force-write flag of the given option
120 * The name of the option
121 * @return The force-write flag of the given option
123 public boolean getForceWriteFlag(String option) {
124 return Boolean.valueOf(getField("forceWriteFlag." + option));