From: David ‘Bombe’ Roden Date: Fri, 8 Apr 2011 13:36:11 +0000 (+0200) Subject: Add method to return an int with a default value. X-Git-Tag: 0.6.5^2~39^2~43 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=c44520f25b0064b9ca6a00b2450445954e8d577e Add method to return an int with a default value. --- diff --git a/src/main/java/net/pterodactylus/sone/freenet/fcp/AbstractCommand.java b/src/main/java/net/pterodactylus/sone/freenet/fcp/AbstractCommand.java index 3475910..6018c38 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/fcp/AbstractCommand.java +++ b/src/main/java/net/pterodactylus/sone/freenet/fcp/AbstractCommand.java @@ -72,4 +72,20 @@ public abstract class AbstractCommand implements Command { } } + /** + * Returns an int value from the given simple field set, returning a default + * value if the value can not be found or converted. + * + * @param simpleFieldSet + * The simple field set to get the value from + * @param key + * The key of the value + * @param defaultValue + * The default value + * @return The int value + */ + protected int getInt(SimpleFieldSet simpleFieldSet, String key, int defaultValue) { + return simpleFieldSet.getInt(key, defaultValue); + } + }