From: David ‘Bombe’ Roden Date: Sat, 15 Jan 2011 20:10:35 +0000 (+0100) Subject: Add String options. X-Git-Tag: 0.4^2~8^2~2 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=e371dfd08d8b177c097f260f4b1d22b186d8d5b4;p=Sone.git Add String options. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Options.java b/src/main/java/net/pterodactylus/sone/core/Options.java index f77c085..b7ece81 100644 --- a/src/main/java/net/pterodactylus/sone/core/Options.java +++ b/src/main/java/net/pterodactylus/sone/core/Options.java @@ -161,6 +161,9 @@ public class Options { /** Holds all {@link Integer} {@link Option}s. */ private final Map> integerOptions = Collections.synchronizedMap(new HashMap>()); + /** Holds all {@link String} {@link Option}s. */ + private final Map> stringOptions = Collections.synchronizedMap(new HashMap>()); + /** * Adds a boolean option. * @@ -213,4 +216,30 @@ public class Options { return integerOptions.get(name); } + /** + * Adds a {@link String} {@link Option}. + * + * @param name + * The name of the option + * @param stringOption + * The option + * @return The given option + */ + public Option addStringOption(String name, Option stringOption) { + stringOptions.put(name, stringOption); + return stringOption; + } + + /** + * Returns a {@link String} {@link Option}. + * + * @param name + * The name of the string option to get + * @return The string option, or {@code null} if there is no option with the + * given name + */ + public Option getStringOption(String name) { + return stringOptions.get(name); + } + }