X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FOptions.java;h=94fbec1b41ed17d8b95259b421f8337e68fb5b55;hb=eb3ce631f002a98346eab4a08a27dc10746c61c4;hp=f77c0856b62b2c3a85e4ba7ff5fdf71860bd28e5;hpb=8409411dedce0dd2512bb140f2719f4cb281bc76;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/core/Options.java b/src/main/java/net/pterodactylus/sone/core/Options.java
index f77c085..94fbec1 100644
--- a/src/main/java/net/pterodactylus/sone/core/Options.java
+++ b/src/main/java/net/pterodactylus/sone/core/Options.java
@@ -1,3 +1,20 @@
+/*
+ * Sone - Options.java - Copyright © 2010 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 3 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, see .
+ */
+
package net.pterodactylus.sone.core;
import java.util.ArrayList;
@@ -161,6 +178,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 +233,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);
+ }
+
}