labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gse...@apache.org
Subject svn commit: r652480 - /labs/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElementVerifier.java
Date Thu, 01 May 2008 11:44:57 GMT
Author: gseitz
Date: Thu May  1 04:44:57 2008
New Revision: 652480

URL: http://svn.apache.org/viewvc?rev=652480&view=rev
Log:
[vysper] added convenience methods

Modified:
    labs/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElementVerifier.java

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElementVerifier.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElementVerifier.java?rev=652480&r1=652479&r2=652480&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElementVerifier.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/xmlfragment/XMLElementVerifier.java Thu
May  1 04:44:57 2008
@@ -42,6 +42,13 @@
 		return null != element.getAttribute(name);
 	}
 
+	/**
+	 * Checks whether all given attributes are present on the element.
+	 * 
+	 * @param names
+	 *            the attributes to check
+	 * @return true iff all attributes are present, false otherwise
+	 */
 	public boolean allAttributesPresent(String... names) {
 		if (names == null) {
 			return false;
@@ -54,6 +61,29 @@
 		return true;
 	}
 
+	/**
+	 * Checks whether only the given attributes are present on the element.
+	 * 
+	 * @param names
+	 *            the attributes to check
+	 * @return true iff only the given attributes are present, false otherwise
+	 */
+	public boolean onlyAttributesPresent(String... names) {
+		if (names == null) {
+			return false;
+		}
+		return element.getAttributes().size() == names.length
+				&& allAttributesPresent(names);
+	}
+
+	/**
+	 * Checks whether any of the given attributes are present on the element.
+	 * 
+	 * @param names
+	 *            the attributes to check
+	 * @return true iff at least one of the given attributes is present, false
+	 *         otherwise
+	 */
 	public boolean anyAttributePresent(String... names) {
 		if (names == null) {
 			return false;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message