From: David ‘Bombe’ Roden Date: Wed, 2 Jul 2008 18:22:25 +0000 (+0200) Subject: return value with default value X-Git-Tag: 0.7~21 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c2f52b9ee948150d1849f8ba3f088da41ce3b4c4;p=jSite.git return value with default value --- diff --git a/src/de/todesbaum/util/xml/SimpleXML.java b/src/de/todesbaum/util/xml/SimpleXML.java index a45f3d9..d42f13f 100644 --- a/src/de/todesbaum/util/xml/SimpleXML.java +++ b/src/de/todesbaum/util/xml/SimpleXML.java @@ -229,6 +229,18 @@ public class SimpleXML { } /** + * Returns the value of this node. If the node does not have a value, the + * given default value is returned. + * + *@param defaultValue + * The default value to return if the node does not have a value + * @return The value of this node + */ + public String getValue(String defaultValue) { + return (value == null) ? defaultValue : value; + } + + /** * Creates a {@link Document} from this node and all its child nodes. * * @return The {@link Document} created from this node