X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Ffcp%2FConfigData.java;fp=src%2Fnet%2Fpterodactylus%2Ffcp%2FConfigData.java;h=990cbe632d26056c75789be58292b9060cef019d;hb=f553531be78d6d6d95dc152728f2b8d40242b57d;hp=0000000000000000000000000000000000000000;hpb=10ac8b357e259afe823fa9d75558305ce717324e;p=jFCPlib.git diff --git a/src/net/pterodactylus/fcp/ConfigData.java b/src/net/pterodactylus/fcp/ConfigData.java new file mode 100644 index 0000000..990cbe6 --- /dev/null +++ b/src/net/pterodactylus/fcp/ConfigData.java @@ -0,0 +1,130 @@ +/* + * jSite2 - ConfigData.java - + * Copyright © 2008 David Roden + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.pterodactylus.fcp; + +/** + * A “ConfigData” message contains various aspects of the node’s configuration. + * + * @see GetConfig + * @author David ‘Bombe’ Roden <bombe@freenetproject.org> + * @version $Id$ + */ +public class ConfigData extends BaseMessage { + + /** + * Creates a new “ConfigData” message that wraps the received message. + * + * @param receivedMessage + * The received message + */ + ConfigData(FcpMessage receivedMessage) { + super(receivedMessage); + } + + /** + * Returns the current value of the given option. + * + * @param option + * The name of the option + * @return The current value of the option + */ + public String getCurrent(String option) { + return getField("current." + option); + } + + /** + * Returns the short description of the given option. + * + * @param option + * The name of the option + * @return The short description of the option + */ + public String getShortDescription(String option) { + return getField("shortDescription." + option); + } + + /** + * Returns the long description of the given option. + * + * @param option + * The name of the option + * @return The long description of the option + */ + public String getLongDescription(String option) { + return getField("longDescription." + option); + } + + /** + * Returns the data type of the given option. + * + * @param option + * The name of the option + * @return The data type of the option + */ + public String getDataType(String option) { + return getField("dataType." + option); + } + + /** + * Returns the default value of the given option. + * + * @param option + * The name of the option + * @return The default value of the option + */ + public String getDefault(String option) { + return getField("default." + option); + } + + /** + * Returns the sort order of the given option. + * + * @param option + * The name of the option + * @return The sort order of the option, or -1 if the sort + * order could not be parsed + */ + public int getSortOrder(String option) { + return FcpUtils.safeParseInt(getField("sortOrder." + option)); + } + + /** + * Returns the expert flag of the given option. + * + * @param option + * The name of the option + * @return The expert flag of the option + */ + public boolean getExpertFlag(String option) { + return Boolean.valueOf(getField("expertFlag." + option)); + } + + /** + * Returns the force-write flag of the given option + * + * @param option + * The name of the option + * @return The force-write flag of the given option + */ + public boolean getForceWriteFlag(String option) { + return Boolean.valueOf(getField("forceWriteFlag." + option)); + } + +}