From e371dfd08d8b177c097f260f4b1d22b186d8d5b4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 15 Jan 2011 21:10:35 +0100 Subject: [PATCH] Add String options. --- .../java/net/pterodactylus/sone/core/Options.java | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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); + } + } -- 2.7.4